mongodb v3 driver vc++ community addition linker errors - mongodb

I'm getting the following linker errors in types.hpp while compiling in vc++ 2017. How shall i solve them ?
Below is the code I'm tyring to compile in vc++.
Additional directories included.
E:\boost_1_61_0-bin-msvc-all-32-64\boost_1_61_0;E:\nosql_db\mongo-cxx-driver-r3.1.3\include\mongocxx\v_noabi;E:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi;E:\nosql_db\mon-c-driver\include\libbson-1.0;E:\nosql_db\mon-c-driver\include\libmongoc-1.0;%(AdditionalDependencies)
#include "stdafx.h"
#include <iostream>
#include <bsoncxx/builder/stream/document.hpp>
#include <bsoncxx/json.hpp>
#include <mongocxx/client.hpp>
#include <mongocxx/instance.hpp>
using bsoncxx::builder::stream::document;
int main()
{
mongocxx::instance inst{};
mongocxx::client conn{ mongocxx::uri{} };
bsoncxx::builder::stream::document document{};
auto collection = conn["testdb"]["testcollection"];
document << "hello" << "world";
collection.insert_one(document.view());
auto cursor = collection.find({});
for (auto&& doc : cursor) {
std::cout << bsoncxx::to_json(doc) << std::endl;
}
return 0;
}
everity Code Description Project File Line Suppression State
Error (active) E0145 member "bsoncxx::v_noabi::types::b_double::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 86
Error (active) E0145 member "bsoncxx::v_noabi::types::b_utf8::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 111
Error (active) E0145 member "bsoncxx::v_noabi::types::b_document::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 149
Error (active) E0145 member "bsoncxx::v_noabi::types::b_array::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 181
Error (active) E0145 member "bsoncxx::v_noabi::types::b_binary::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 206
Error (active) E0145 member "bsoncxx::v_noabi::types::b_undefined::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 230
Error (active) E0145 member "bsoncxx::v_noabi::types::b_oid::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 246
Error (active) E0145 member "bsoncxx::v_noabi::types::b_bool::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 264
Error (active) E0145 member "bsoncxx::v_noabi::types::b_date::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 289
Error (active) E0145 member "bsoncxx::v_noabi::types::b_null::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 350
Error (active) E0145 member "bsoncxx::v_noabi::types::b_regex::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 366
Error (active) E0145 member "bsoncxx::v_noabi::types::b_dbpointer::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 402
Error (active) E0145 member "bsoncxx::v_noabi::types::b_code::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 421
Error (active) E0145 member "bsoncxx::v_noabi::types::b_symbol::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 462
Error (active) E0145 member "bsoncxx::v_noabi::types::b_codewscope::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 500
Error (active) E0145 member "bsoncxx::v_noabi::types::b_int32::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 533
Error (active) E0145 member "bsoncxx::v_noabi::types::b_timestamp::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 562
Error (active) E0145 member "bsoncxx::v_noabi::types::b_int64::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 581
Error (active) E0145 member "bsoncxx::v_noabi::types::b_decimal128::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 606
Error (active) E0145 member "bsoncxx::v_noabi::types::b_minkey::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 637
Error (active) E0145 member "bsoncxx::v_noabi::types::b_maxkey::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 653
Error LNK1107 invalid or corrupt file: cannot read at 0x398 textapp E:\nosql_db\mongo-cxx-driver-r3.1.3\bin\mongocxx.dll 1
Steps followed for installing the driver.
cmake -G "Visual Studio 14 2015 Win64" "-DCMAKE_INSTALL_PREFIX=E:\\nosql_db\\mongo-c-driver" "-DCMAKE_BUILD_TYPE=Release"
msbuild.exe /p:Configuration=Release ALL_BUILD.vcxproj
msbuild.exe /p:Configuration=Release INSTALL.vcxproj
cmake -G "Visual Studio 14 2015 Win64" "-DENABLE_SSL=WINDOWS" "-DENABLE_SASL=SSPI" "-DCMAKE_INSTALL_PREFIX=E:\\nosql_db\\mongo-c-driver1" "-DCMAKE_PREFIX_PATH=E:\\nosql_db\\mongo-c-driver" "-DCMAKE_BUILD_TYPE=Release"
msbuild.exe /p:Configuration=Release ALL_BUILD.vcxproj
msbuild.exe /p:Configuration=Release INSTALL.vcxproj
cmake.exe -G "Visual Studio 14 Win64" -DCMAKE_INSTALL_PREFIX=E:\\nosql_db\\mongo-cxx-driver1 -DCMAKE_PREFIX_PATH=E:\\nosql_db\\mon-c-driver -DBOOST_ROOT=E:\\boost_1_65_1
msbuild.exe ALL_BUILD.vcxproj
msbuild.exe INSTALL.vcxproj
Then added additional libraries in vc++ configuration.
E:\nosql_db\mongo-cxx-driver1\include\bsoncxx\v_noabi;E:\nosql_db\mongo-cxx-driver1\include\mongocxx\v_noabi;E:\nosql_db\mon-c-driver\include\libbson-1.0;E:\nosql_db\mon-c-driver\include\libmongoc-1.0;
E:\nosql_db\mongo-cxx-driver1\bin\mongocxx.dll;E:\nosql_db\mongo-cxx-driver1\bin\bsoncxx.dll;E:\nosql_db\mon-c-driver\bin\libbson-1.0.dll;E:\nosql_db\mon-c-driver\bin\libmongoc-1.0.dll;
Here are my linker settings:
/MANIFEST /LTCG:incremental /NXCOMPAT /PDB:"E:\workouts\cpp\textapp\textapp\x64\Release\textapp.pdb" /DYNAMICBASE "mongocxx.dll" "bsoncxx.dll" "libbson-1.0.dll" "libmongoc-1.0.dll" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /IMPLIB:"E:\nosql_db\mongo-cxx-driver1\bin\mongocxx.dll;E:\nosql_db\mongo-cxx-driver1\bin\bsoncxx.dll;E:\nosql_db\mon-c-driver\bin\libbson-1.0.dll;E:\nosql_db\mon-c-driver\bin\libmongoc-1.0.dll;" /DEBUG:FULL /MACHINE:X64 /OPT:REF /INCREMENTAL:NO /PGD:"E:\workouts\cpp\textapp\textapp\x64\Release\textapp.pgd" /SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"x64\Release\textapp.exe.intermediate.manifest" /OPT:ICF /ERRORREPORT:PROMPT /NOLOGO /LIBPATH:"E:\nosql_db\mongo-cxx-driver1\lib\bsoncxx.lib" /LIBPATH:"E:\nosql_db\mongo-cxx-driver1\lib\libbsoncxx.lib" /LIBPATH:"E:\nosql_db\mongo-cxx-driver1\lib\libmongocxx.lib" /LIBPATH:"E:\nosql_db\mongo-cxx-driver1\lib\mongocxx.lib" /LIBPATH:"E:\nosql_db\mon-c-driver\lib\bson-1.0.lib" /LIBPATH:"E:\nosql_db\mon-c-driver\lib\mongoc-1.0.lib" /TLBID:1

Related

cannot create cluster plugin did not respond

vsphere_compute_cluster.compute_cluster_create\[0\]: Creating...
vsphere_compute_cluster.compute_cluster_create\[1\]: Creating...
╷
│ Error: Plugin did not respond
│
│ with vsphere_compute_cluster.compute_cluster_create\[0\],
│ on main.tf line 102, in resource "vsphere_compute_cluster" "compute_cluster_create":
│ 102: resource "vsphere_compute_cluster" "compute_cluster_create" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(\*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵
╷
│ Error: Plugin did not respond
│
│ with vsphere_compute_cluster.compute_cluster_create\[1\],
│ on main.tf line 102, in resource "vsphere_compute_cluster" "compute_cluster_create":
│ 102: resource "vsphere_compute_cluster" "compute_cluster_create" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(\*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵
Stack trace from the terraform-provider-vsphere_v2.1.0_x5 plugin:
panic: interface conversion: interface {} is \*schema.Set, not \[\]interface {}
goroutine 57 \[running\]:
github.com/hashicorp/terraform-provider-vsphere/vsphere.updateVsanDisks(0xc000284e80, 0xc000283100, 0x14542e0, 0xc000777d60, 0x0, 0x0)
/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-vsphere/vsphere/resource_vsphere_compute_cluster.go:1264 +0x1945
github.com/hashicorp/terraform-provider-vsphere/vsphere.resourceVSphereComputeClusterApplyCreate(0xc000284e80, 0x14542e0, 0xc000777d60, 0x1, 0x1, 0x2d)
/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-vsphere/vsphere/resource_vsphere_compute_cluster.go:726 +0x549
github.com/hashicorp/terraform-provider-vsphere/vsphere.resourceVSphereComputeClusterCreate(0xc000284e80, 0x14542e0, 0xc000777d60, 0x5, 0xffffffffffffffff)
/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-vsphere/vsphere/resource_vsphere_compute_cluster.go:513 +0xdd
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(\*Resource).create(0xc000202620, 0x1a0ed68, 0xc0004c4a40, 0xc000284e80, 0x14542e0, 0xc000777d60, 0x0, 0x0, 0x0)
/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-vsphere/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource.go:318 +0x1ee
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(\*Resource).Apply(0xc000202620, 0x1a0ed68, 0xc0004c4a40, 0xc0007fbd50, 0xc00007aa00, 0x14542e0, 0xc000777d60, 0x0, 0x0, 0x0, ...)
/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-vsphere/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource.go:456 +0x67b
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(\*GRPCProviderServer).ApplyResourceChange(0xc0000b23f0, 0x1a0ed68, 0xc0004c4a40, 0xc00072fa90, 0xc0004c4a40, 0x16dd420, 0xc000550500)
/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-vsphere/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/grpc_provider.go:955 +0x8ef
github.com/hashicorp/terraform-plugin-go/tfprotov5/server.(\*server).ApplyResourceChange(0xc00062dac0, 0x1a0ee10, 0xc0004c4a40, 0xc0007fbb20, 0xc00062dac0, 0xc000550570, 0xc000681ba0)
/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-vsphere/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/server/server.go:332 +0xb5
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5.\_Provider_ApplyResourceChange_Handler(0x16dd420, 0xc00062dac0, 0x1a0ee10, 0xc000550570, 0xc0004b1e00, 0x0, 0x1a0ee10, 0xc000550570, 0xc000574d80, 0xd23)
/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-vsphere/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:380 +0x214
google.golang.org/grpc.(\*Server).processUnaryRPC(0xc0001aefc0, 0x1a18db8, 0xc000001980, 0xc0000e4e00, 0xc000344750, 0x238a480, 0x0, 0x0, 0x0)
/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-vsphere/vendor/google.golang.org/grpc/server.go:1194 +0x52b
google.golang.org/grpc.(\*Server).handleStream(0xc0001aefc0, 0x1a18db8, 0xc000001980, 0xc0000e4e00, 0x0)
/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-vsphere/vendor/google.golang.org/grpc/server.go:1517 +0xd0c
google.golang.org/grpc.(\*Server).serveStreams.func1.2(0xc00009e420, 0xc0001aefc0, 0x1a18db8, 0xc000001980, 0xc0000e4e00)
/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-vsphere/vendor/google.golang.org/grpc/server.go:859 +0xab
created by google.golang.org/grpc.(\*Server).serveStreams.func1
/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-vsphere/vendor/google.golang.org/grpc/server.go:857 +0x1fd
Error: The terraform-provider-vsphere_v2.1.0_x5 plugin crashed!
This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.
hello, i try to create a cluster in Vsphere, and it fails with error above
cluster is created in vsphere UI,
2022-04-05T09:34:01.248Z \[TRACE\] maybeTainted: vsphere_compute_cluster.compute_cluster_create\[0\] encountered an error during creation, so it is now marked as tainted
when i try to destroy, it destroys nothing

when i install the c# in Visual Studio Code,It's give me error

OmniSharp server started.
Path: C:\Users\tlx_a\.vscode\extensions\ms-dotnettools.csharp-1.21.17\.omnisharp\1.35.0\OmniSharp.exe
PID: 13212
System.NullReferenceException: 未将对象引用设置到对象的实例。
在 OmniSharp.CompositionHostBuilder.SafeGetTypes(Assembly a) 位置 D:\a\1\s\src\OmniSharp.Host\CompositionHostBuilder.cs:行号 103
在 System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
在 System.Linq.Buffer`1..ctor(IEnumerable`1 source)
在 System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
在 OmniSharp.CompositionHostBuilder.Build() 位置 D:\a\1\s\src\OmniSharp.Host\CompositionHostBuilder.cs:行号 88
在 OmniSharp.Stdio.Host..ctor(TextReader input, ISharedTextWriter writer, IOmniSharpEnvironment environment, IServiceProvider serviceProvider, CompositionHostBuilder compositionHostBuilder, ILoggerFactory loggerFactory, CancellationTokenSource cancellationTokenSource) 位置 D:\a\1\s\src\OmniSharp.Stdio\Host.cs:行号 47
在 OmniSharp.Stdio.Driver.Program.<>c__DisplayClass0_1.<Main>b__1() 位置 D:\a\1\s\src\OmniSharp.Stdio.Driver\Program.cs:行号 56
在 OmniSharp.HostHelpers.Start(Func`1 action) 位置 D:\a\1\s\src\OmniSharp.Host\HostHelpers.cs:行号 29
[ERROR] Error: OmniSharp server load timed out. Use the 'omnisharp.projectLoadTimeout' setting to override the default delay (one minute).
The error like this.
I tried to install several versions, but nothing improved.

Debug "An item with the same key has already been added" exception

I took a crash dump of my application when I got the "An item with the same key has already been added" exception. I need help finding which object caused this exception. I could print the exception but couldn't figure out how to find the exact key that caused the exception.
This is likely the state you have:
[...]
(3250.7ec): CLR exception - code e0434352 (!!! second chance !!!)
[...]
0:000> .loadby sos clr
0:000> !pe
Exception object: 030c31e8
Exception type: System.ArgumentException
Message: An item with the same key has already been added.
InnerException: <none>
StackTrace (generated):
SP IP Function
010FEE1C 6045F705 mscorlib_ni!System.ThrowHelper.ThrowArgumentException(System.ExceptionResource)+0x35
010FEE2C 609410C7 mscorlib_ni!System.Collections.Generic.Dictionary`2[[System.__Canon, mscorlib],[System.__Canon, mscorlib]].Insert(System.__Canon, System.__Canon, Boolean)+0xc6af67
010FEE60 5FD4B310 mscorlib_ni!System.Collections.Generic.Dictionary`2[[System.__Canon, mscorlib],[System.__Canon, mscorlib]].Add(System.__Canon, System.__Canon)+0x10
010FEE68 017004F5 KeyAlreadyAdded!KeyAlreadyAdded.Program.Main()+0x45
[...]
In the native call stack, you can see the call to Dictionary.Add() again, but with the additional information for the frame number:
0:000> k
# ChildEBP RetAddr
00 010fecb0 618fac03 KERNELBASE!RaiseException+0x62
01 010fed4c 618fae08 clr!RaiseTheExceptionInternalOnly+0x27c
02 010fee14 6045f705 clr!IL_Throw+0x141
03 010fee24 609410c7 mscorlib_ni!System.ThrowHelper.ThrowArgumentException(System.ExceptionResource)$##6000335+0x35
04 010fee50 5fd4b310 mscorlib_ni![COLD] System.Collections.Generic.Dictionary`2[System.__Canon,System.__Canon].Insert(System.__Canon, System.__Canon, Boolean)$##6003922+0x87
05 010fee68 6181ebe6 mscorlib_ni!System.Collections.Generic.Dictionary`2[System.__Canon,System.__Canon].Add(System.__Canon, System.__Canon)$##6003915+0x10
[...]
At the Insert() method, you can use the ebx register to get the key:
0:000> .frame /r 4
04 010fee50 5fd4b310 mscorlib_ni![COLD] System.Collections.Generic.Dictionary`2[System.__Canon,System.__Canon].Insert(System.__Canon, System.__Canon, Boolean)$##6003922+0x87
eax=010fec58 ebx=030c2364 ecx=00000005 edx=00000000 esi=030c23b0 edi=030c2364
[...]
0:000> !do 030c2364
Name: System.String
MethodTable: 5fdefd60
EEClass: 5f9c4e90
Size: 22(0x16) bytes
File: C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll
String: this
[...]
So in this case, the duplicate key being added is the string "this". Here's the code:
using System.Collections.Generic;
namespace KeyAlreadyAdded
{
class Program
{
static Dictionary<string, string> dict = new Dictionary<string, string> {{"this", "was already inside"}};
static void Main()
{
dict.Add("that", "goes in easily");
dict.Add("this", "however, causes a duplicate key exception");
}
}
}

How to setup NativeScript Angular with Karma, karma-typescript, Jasmine, Mocha, Chai

I'm trying to configure karma.config.js to run with NativeScript Angular project following the official doc:
https://docs.nativescript.org/angular/tooling/testing
The problem is the tests always failed and always running node_modules/ and platforms/ too but I mentioned them in excludeFiles property.
I created a github repo to reproduce it
I'm using a separated branches to reproduce it with jasmine and mocha
https://github.com/francisrod01/native-script-angular2-karma-demo
Scenario 1: karma-typescript + jasmine
dependencies:
nativescript-angular: ~5.3.0
nativescript-theme-core: ~1.0.4
nativescript-unit-test-runner: ^0.3.4
reflect-metadata: ~0.1.8
tns-core-modules: ~4.0.0
devDependencies:
#types/node: ^10.1.4
babel-traverse: 6.26.0
babel-types: 6.26.0
babylon: 6.18.0
jasmine-core: ^3.1.0
karma: ^2.0.2
karma-jasmine: ^1.1.2
karma-nativescript-launcher: ^0.4.0
karma-typescript: ^3.0.12
lazy: 1.0.11
nativescript: ^4.0.2
nativescript-dev-typescript: ~0.7.0
typescript: ~2.7.2
The karma.conf.js file:
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine', 'karma-typescript'],
// list of files / patterns to load in the browser
files: [
{ pattern: 'app/**/*.ts' },
{ pattern: 'app/tests/*.ts' }
],
// list of files to exclude
exclude: [
'node_modules',
'platforms'
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'app/**/*.ts': ['karma-typescript', 'coverage'],
'app/tests/*.ts': ['karma-typescript']
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress', 'coverage', 'karma-typescript'],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],
customLaunchers: {
android: {
base: 'NS',
platform: 'android'
},
ios: {
base: 'NS',
platform: 'ios'
},
ios_simulator: {
base: 'NS',
platform: 'ios',
arguments: ['--emulator']
}
},
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false
})
}
Bellow follow the compile error output:
29 05 2018 17:00:32.699:WARN [watcher]: All files matched by "/home/paneladm/my-ns-app/app/tests/*.ts" were excluded or matched by prior matchers.
29 05 2018 17:00:32.965:INFO [compiler.karma-typescript]: Compiling project using Typescript 2.6.2
29 05 2018 17:00:35.600:ERROR [compiler.karma-typescript]: app/utils/file-reader.ts(10,16): error TS2693: 'Promise' only refers to a type, but is being used as a value here.
29 05 2018 17:00:35.601:ERROR [compiler.karma-typescript]: node_modules/#angular/common/src/directives/ng_class.d.ts(48,34): error TS2304: Cannot find name 'Set'.
29 05 2018 17:00:35.601:ERROR [compiler.karma-typescript]: node_modules/#angular/core/src/change_detection/differs/default_iterable_differ.d.ts(12,32): error TS2304: Cannot find name 'Iterable'.
29 05 2018 17:00:35.601:ERROR [compiler.karma-typescript]: node_modules/#angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts(24,16): error TS2304: Cannot find name 'Map'.
29 05 2018 17:00:35.601:ERROR [compiler.karma-typescript]: node_modules/#angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts(32,16): error TS2304: Cannot find name 'Map'.
29 05 2018 17:00:35.601:ERROR [compiler.karma-typescript]: node_modules/#angular/core/src/change_detection/differs/iterable_differs.d.ts(14,48): error TS2304: Cannot find name 'Iterable'.
29 05 2018 17:00:35.602:ERROR [compiler.karma-typescript]: node_modules/#angular/core/src/change_detection/differs/keyvalue_differs.d.ts(22,18): error TS2304: Cannot find name 'Map'.
29 05 2018 17:00:35.602:ERROR [compiler.karma-typescript]: node_modules/#angular/core/src/di/reflective_provider.d.ts(87,123): error TS2304: Cannot find name 'Map'.
29 05 2018 17:00:35.602:ERROR [compiler.karma-typescript]: node_modules/#angular/core/src/di/reflective_provider.d.ts(87,165): error TS2304: Cannot find name 'Map'.
29 05 2018 17:00:35.602:ERROR [compiler.karma-typescript]: node_modules/#angular/platform-browser/src/browser/browser_adapter.d.ts(79,33): error TS2304: Cannot find name 'Map'.
29 05 2018 17:00:35.602:ERROR [compiler.karma-typescript]: node_modules/#angular/platform-browser/src/dom/dom_adapter.d.ts(97,42): error TS2304: Cannot find name 'Map'.
29 05 2018 17:00:35.602:ERROR [compiler.karma-typescript]: node_modules/#angular/platform-browser/src/dom/shared_styles_host.d.ts(11,30): error TS2304: Cannot find name 'Set'.
29 05 2018 17:00:35.602:ERROR [compiler.karma-typescript]: node_modules/#angular/platform-browser/src/dom/shared_styles_host.d.ts(22,30): error TS2304: Cannot find name 'Set'.
29 05 2018 17:00:35.603:ERROR [compiler.karma-typescript]: node_modules/nativescript-angular/dom-adapter.d.ts(79,34): error TS2304: Cannot find name 'Map'.
29 05 2018 17:00:35.603:ERROR [compiler.karma-typescript]: node_modules/nativescript-drop-down/drop-down.d.ts(16,33): error TS2307: Cannot find module 'data/observable-array'.
29 05 2018 17:00:35.603:ERROR [compiler.karma-typescript]: node_modules/nativescript-drop-down/drop-down.d.ts(17,62): error TS2307: Cannot find module 'ui/core/view'.
29 05 2018 17:00:35.603:ERROR [compiler.karma-typescript]: node_modules/nativescript-drop-down/drop-down.d.ts(18,30): error TS2307: Cannot find module 'ui/gestures/gestures'.
29 05 2018 17:00:35.603:ERROR [compiler.karma-typescript]: node_modules/nativescript-drop-down/drop-down.d.ts(19,29): error TS2307: Cannot find module 'ui/list-picker'.
29 05 2018 17:00:35.603:ERROR [compiler.karma-typescript]: node_modules/rxjs/Observable.d.ts(58,60): error TS2693: 'Promise' only refers to a type, but is being used as a value here.
29 05 2018 17:00:35.603:ERROR [compiler.karma-typescript]: node_modules/rxjs/Observable.d.ts(74,59): error TS2693: 'Promise' only refers to a type, but is being used as a value here.
29 05 2018 17:00:35.604:ERROR [compiler.karma-typescript]: node_modules/tns-core-modules/ui/core/view-base/view-base.d.ts(243,24): error TS2304: Cannot find name 'Set'.
29 05 2018 17:00:35.604:ERROR [compiler.karma-typescript]: node_modules/tns-core-modules/ui/core/view-base/view-base.d.ts(244,30): error TS2304: Cannot find name 'Set'.
29 05 2018 17:00:35.604:ERROR [compiler.karma-typescript]: node_modules/tns-core-modules/ui/core/view/view.d.ts(352,17): error TS2304: Cannot find name 'Set'.
29 05 2018 17:00:35.604:ERROR [compiler.karma-typescript]: node_modules/tns-core-modules/ui/core/view/view.d.ts(353,23): error TS2304: Cannot find name 'Set'.
29 05 2018 17:00:35.604:ERROR [compiler.karma-typescript]: node_modules/tns-core-modules/ui/styling/css-selector/css-selector.d.ts(16,18): error TS2304: Cannot find name 'Set'.
29 05 2018 17:00:35.604:ERROR [compiler.karma-typescript]: node_modules/tns-core-modules/ui/styling/css-selector/css-selector.d.ts(17,24): error TS2304: Cannot find name 'Set'.
29 05 2018 17:00:35.604:ERROR [compiler.karma-typescript]: node_modules/tns-core-modules/ui/styling/css-selector/css-selector.d.ts(57,41): error TS2304: Cannot find name 'Map'.
29 05 2018 17:00:35.604:ERROR [compiler.karma-typescript]: node_modules/tns-core-modules/ui/styling/css-selector/css-selector.d.ts(60,18): error TS2304: Cannot find name 'Set'.
29 05 2018 17:00:35.605:ERROR [compiler.karma-typescript]: node_modules/tns-core-modules/ui/styling/css-selector/css-selector.d.ts(61,21): error TS2304: Cannot find name 'Set'.
29 05 2018 17:00:35.708:INFO [compiler.karma-typescript]: Compiled 17 files in 2717 ms.
29 05 2018 17:00:35.723:WARN [karma]: Port 9876 in use
29 05 2018 17:00:35.724:INFO [karma]: Karma v2.0.2 server started at http://0.0.0.0:9877/
29 05 2018 17:00:35.724:INFO [launcher]: Launching browser android with unlimited concurrency
29 05 2018 17:00:35.752:INFO [launcher]: Starting browser NativeScript Unit Test Runner
Copying template files...
⠙ Installing tns-android
⠸ 29 05 2018 17:00:36.854:ERROR [karma]: Error: Unable to resolve module [./src/localize] from [/home/paneladm/my-ns-app/node_modules/nativescript-localize/angular.js]
{
"basedir": "/home/paneladm/my-ns-app",
"extensions": [
".js",
".json",
".ts",
".tsx"
],
"moduleDirectory": [
"node_modules"
],
"modules": {
"assert": "/home/paneladm/my-ns-app/node_modules/assert/assert.js",
"buffer": "/home/paneladm/my-ns-app/node_modules/buffer/index.js",
"child_process": "/home/paneladm/my-ns-app/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
"cluster": "/home/paneladm/my-ns-app/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
"console": "/home/paneladm/my-ns-app/node_modules/console-browserify/index.js",
"constants": "/home/paneladm/my-ns-app/node_modules/constants-browserify/constants.json",
"crypto": "/home/paneladm/my-ns-app/node_modules/crypto-browserify/index.js",
"dgram": "/home/paneladm/my-ns-app/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
"dns": "/home/paneladm/my-ns-app/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
"domain": "/home/paneladm/my-ns-app/node_modules/domain-browser/source/index.js",
"events": "/home/paneladm/my-ns-app/node_modules/events/events.js",
"fs": "/home/paneladm/my-ns-app/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
"http": "/home/paneladm/my-ns-app/node_modules/stream-http/index.js",
"https": "/home/paneladm/my-ns-app/node_modules/https-browserify/index.js",
"module": "/home/paneladm/my-ns-app/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
"net": "/home/paneladm/my-ns-app/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
"os": "/home/paneladm/my-ns-app/node_modules/os-browserify/browser.js",
"path": "/home/paneladm/my-ns-app/node_modules/path-browserify/index.js",
"punycode": "/home/paneladm/my-ns-app/node_modules/punycode/punycode.js",
"querystring": "/home/paneladm/my-ns-app/node_modules/querystring-es3/index.js",
"readline": "/home/paneladm/my-ns-app/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
"repl": "/home/paneladm/my-ns-app/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
"stream": "/home/paneladm/my-ns-app/node_modules/stream-browserify/index.js",
"_stream_duplex": "/home/paneladm/my-ns-app/node_modules/readable-stream/duplex.js",
"_stream_passthrough": "/home/paneladm/my-ns-app/node_modules/readable-stream/passthrough.js",
"_stream_readable": "/home/paneladm/my-ns-app/node_modules/readable-stream/readable.js",
"_stream_transform": "/home/paneladm/my-ns-app/node_modules/readable-stream/transform.js",
"_stream_writable": "/home/paneladm/my-ns-app/node_modules/readable-stream/writable.js",
"string_decoder": "/home/paneladm/my-ns-app/node_modules/string_decoder/lib/string_decoder.js",
"sys": "/home/paneladm/my-ns-app/node_modules/util/util.js",
"timers": "/home/paneladm/my-ns-app/node_modules/timers-browserify/main.js",
"tls": "/home/paneladm/my-ns-app/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
"tty": "/home/paneladm/my-ns-app/node_modules/tty-browserify/index.js",
"url": "/home/paneladm/my-ns-app/node_modules/url/url.js",
"util": "/home/paneladm/my-ns-app/node_modules/util/util.js",
"vm": "/home/paneladm/my-ns-app/node_modules/vm-browserify/index.js",
"zlib": "/home/paneladm/my-ns-app/node_modules/browserify-zlib/lib/index.js",
"_process": "/home/paneladm/my-ns-app/node_modules/process/browser.js"
},
"filename": "",
"paths": []
}
Error: Cannot find module './src/localize' from '/home/paneladm/my-ns-app/node_modules/nativescript-localize'
at /home/paneladm/my-ns-app/node_modules/karma-typescript/dist/bundler/resolve/resolver.js:163:27
at /home/paneladm/my-ns-app/node_modules/browser-resolve/index.js:265:24
at /home/paneladm/my-ns-app/node_modules/browser-resolve/node_modules/resolve/lib/async.js:55:18
at load (/home/paneladm/my-ns-app/node_modules/browser-resolve/node_modules/resolve/lib/async.js:69:43)
at onex (/home/paneladm/my-ns-app/node_modules/browser-resolve/node_modules/resolve/lib/async.js:92:31)
at /home/paneladm/my-ns-app/node_modules/browser-resolve/node_modules/resolve/lib/async.js:22:47
at FSReqWrap.oncomplete (fs.js:170:21)
Test run failed.
Scenario 2: Using karma + mocha, chai
Scenario 2: Dependencies version to karma + mocha:
dependencies:
nativescript-angular: ~5.3.0
nativescript-theme-core: ~1.0.4
nativescript-unit-test-runner: ^0.3.4
reflect-metadata: ~0.1.8
tns-core-modules: ~4.0.0
devDependencies:
babel-traverse: 6.26.0
babel-types: 6.26.0
babylon: 6.18.0
chai: ^4.1.2
karma: ^2.0.2
karma-chai: ^0.1.0
karma-mocha: ^1.3.0
karma-nativescript-launcher: ^0.4.0
lazy: 1.0.11
mocha: ^5.2.0
nativescript: ^4.0.2
nativescript-dev-typescript: ~0.7.0
typescript: ~2.7.2
The karma.conf.js file:
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha', 'chai'],
// list of files / patterns to load in the browser
files: [
'app/**/*.js',
],
// list of files to exclude
exclude: [
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],
customLaunchers: {
android: {
base: 'NS',
platform: 'android'
},
ios: {
base: 'NS',
platform: 'ios'
},
ios_simulator: {
base: 'NS',
platform: 'ios',
arguments: ['--emulator']
}
},
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false
})
}
The error on console:
30 05 2018 12:58:56.816:INFO [watcher]: Changed file ".../app/tests/example.js".
Chrome 66.0.3359 (Linux 0.0.0) ERROR
{
"message": "An error was thrown in afterAll\nUncaught ReferenceError: exports is not defined
On http://localhost:9876/debug.html the Chrome browser, the Karma DEBUG RUNNER shows it:
Uncaught ReferenceError: exports is not defined
at app.component.js:2
The app.component.js compiled file:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("#angular/core");
var AppComponent = /** #class */ (function () {
function AppComponent() {
}
AppComponent = __decorate([
core_1.Component({
selector: "ns-app",
templateUrl: "app.component.html",
})
], AppComponent);
return AppComponent;
}());
exports.AppComponent = AppComponent;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBwLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImFwcC5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxzQ0FBMEM7QUFPMUM7SUFBQTtJQUE0QixDQUFDO0lBQWhCLFlBQVk7UUFMeEIsZ0JBQVMsQ0FBQztZQUNQLFFBQVEsRUFBRSxRQUFRO1lBQ2xCLFdBQVcsRUFBRSxvQkFBb0I7U0FDcEMsQ0FBQztPQUVXLFlBQVksQ0FBSTtJQUFELG1CQUFDO0NBQUEsQUFBN0IsSUFBNkI7QUFBaEIsb0NBQVkiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBDb21wb25lbnQgfSBmcm9tIFwiQGFuZ3VsYXIvY29yZVwiO1xuXG5AQ29tcG9uZW50KHtcbiAgICBzZWxlY3RvcjogXCJucy1hcHBcIixcbiAgICB0ZW1wbGF0ZVVybDogXCJhcHAuY29tcG9uZW50Lmh0bWxcIixcbn0pXG5cbmV4cG9ydCBjbGFzcyBBcHBDb21wb25lbnQgeyB9XG4iXX0=
References
github - karma-typescript - Could it be used in a Nativescript-Angular2 App?
NS discourse - My question about it

jxbrowser on macosx using SWT deadlock

I have finished evaluating jxbrowser integration with Eclipse for Windows and Linux. My last roadblock is Mac. I get a dead lock while instantiating the browser. I am new to cocoa programming, so any pointer will be greatly appreciated.
I took the example project and modify it to work with SWT.
import java.awt.BorderLayout;
import java.awt.Frame;
import org.eclipse.swt.SWT;
import org.eclipse.swt.awt.SWT_AWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.swing.BrowserView;
public class JxBrowserApp {
public static void main(String[] args) {
final Display display = new Display();
final Shell shell = new Shell(display);
Composite composite = new Composite(shell, SWT.EMBEDDED | SWT.NO_BACKGROUND);
Frame frame = SWT_AWT.new_Frame(composite);
Browser browser = new Browser(); // deadlock here
BrowserView browserView = new BrowserView(browser);
frame.add(browserView, BorderLayout.CENTER);
frame.setLocationRelativeTo(null);
frame.setFocusable(true);
browser.loadURL("http://www.google.com");
shell.pack();
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
}
Here is the callstack
JxBrowserApp at localhost:57970
Thread [main] (Suspended)
owns: IPC (id=72)
Unsafe.park(boolean, long) line: not available [native method]
LockSupport.parkNanos(Object, long) line: 215
CountDownLatch$Sync(AbstractQueuedSynchronizer).doAcquireSharedNanos(int, long) line: 1037
CountDownLatch$Sync(AbstractQueuedSynchronizer).tryAcquireSharedNanos(int, long) line: 1328
CountDownLatch.await(long, TimeUnit) line: 277
LatchUtil.await(CountDownLatch, RuntimeException, int) line: 25
LatchUtil.await(CountDownLatch, RuntimeException) line: 20
IPC.a(boolean) line: 159
IPC.start() line: 128
Browser.<init>(BrowserType, BrowserContext, Channel) line: 195
Browser.<init>(BrowserType, BrowserContext) line: 172
Browser.<init>(BrowserContext) line: 139
Browser.<init>() line: 125
JxBrowserApp.main(String[]) line: 27
Thread [AWT-EventQueue-0] (Suspended)
CPlatformView.nativeCreateView(int, int, int, int, long) line: not available [native method]
CPlatformView.initialize(LWWindowPeer, CPlatformResponder) line: 61
CViewPlatformEmbeddedFrame.initialize(Window, LWWindowPeer, PlatformWindow) line: 55
LWWindowPeer.<init>(Window, PlatformComponent, PlatformWindow, LWWindowPeer$PeerType) line: 156
LWCToolkit(LWToolkit).createDelegatedPeer(Window, PlatformComponent, PlatformWindow, LWWindowPeer$PeerType) line: 210
LWCToolkit.createEmbeddedFrame(CViewEmbeddedFrame) line: 204
CViewEmbeddedFrame.addNotify() line: 55
SWT_AWT$1.run() line: not available
InvocationEvent.dispatch() line: 311
EventQueue.dispatchEventImpl(AWTEvent, Object) line: 756
EventQueue.access$500(EventQueue, AWTEvent, Object) line: 97
EventQueue$3.run() line: 709
EventQueue$3.run() line: 703
AccessController.doPrivileged(PrivilegedAction<T>, AccessControlContext) line: not available [native method]
ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(PrivilegedAction<T>, AccessControlContext, AccessControlContext) line: 76
EventQueue.dispatchEvent(AWTEvent) line: 726
EventDispatchThread.pumpOneEventForFilters(int) line: 201
EventDispatchThread.pumpEventsForFilter(int, Conditional, EventFilter) line: 116
EventDispatchThread.pumpEventsForHierarchy(int, Conditional, Component) line: 105
EventDispatchThread.pumpEvents(int, Conditional) line: 101
EventDispatchThread.pumpEvents(Conditional) line: 93
EventDispatchThread.run() line: 82
Daemon Thread [Timer-0] (Suspended)
waiting for: TaskQueue (id=87)
Object.wait(long) line: not available [native method]
TimerThread.mainLoop() line: 552
TimerThread.run() line: 505
Daemon Thread [IPC Server Thread] (Suspended)
PlainSocketImpl.socketAccept(SocketImpl) line: not available [native method]
SocksSocketImpl(AbstractPlainSocketImpl).accept(SocketImpl) line: 409
ServerSocket.implAccept(Socket) line: 545
ServerSocket.accept() line: 513
Server.start(int) line: 81
e.run() line: 1237
Thread.run() line: 745
Daemon Thread [IPC Process Thread] (Suspended)
CGraphicsDevice.nativeGetScreenInsets(int) line: not available [native method]
CGraphicsDevice.getScreenInsets() line: 128
LWCToolkit.getScreenInsets(GraphicsConfiguration) line: 407
SwingUtilities$SharedOwnerFrame(Window).init(GraphicsConfiguration) line: 506
SwingUtilities$SharedOwnerFrame(Window).<init>() line: 537
SwingUtilities$SharedOwnerFrame(Frame).<init>(String) line: 420
SwingUtilities$SharedOwnerFrame(Frame).<init>() line: 385
SwingUtilities$SharedOwnerFrame.<init>() line: 1758
SwingUtilities.getSharedOwnerFrame() line: 1833
JWindow.<init>(Frame) line: 187
JWindow.<init>() line: 139
InternalChromiumProcess.doStart(List<String>) line: 1078
InternalChromiumProcess(ChromiumProcess).start(int) line: 123
d.run() line: 184
Thread.run() line: 745