diff --git a/src/dotnet/clrfunc.cpp b/src/dotnet/clrfunc.cpp index 0c380fc2..5d2b2eca 100644 --- a/src/dotnet/clrfunc.cpp +++ b/src/dotnet/clrfunc.cpp @@ -26,14 +26,20 @@ void clrFuncProxyNearDeath(const Nan::WeakCallbackInfo &data) delete wrap; } +// for not default domain +#pragma managed(push, off) +static Nan::Persistent proxyFactory; +static Nan::Persistent proxyFunction; +#pragma managed(push, pop) + v8::Local ClrFunc::Initialize(System::Func^>^ func) { DBG("ClrFunc::Initialize Func> wrapper"); - static Nan::Persistent proxyFactory; - static Nan::Persistent proxyFunction; - - Nan::EscapableHandleScope scope; + //static Nan::Persistent proxyFactory; + //static Nan::Persistent proxyFunction; + + Nan::EscapableHandleScope scope; ClrFunc^ app = gcnew ClrFunc(); app->func = func; @@ -253,6 +259,28 @@ v8::Local ClrFunc::MarshalCLRToV8(System::Object^ netdata) jsdata = result; } + else if (dynamic_cast^>(netdata) != nullptr) + { + v8::Local result = Nan::New(); + for each (System::Collections::Generic::KeyValuePair^ pair + in (System::Collections::Generic::IDictionary^)netdata) + { + result->Set(pair->Key, stringCLR2V8(pair->Value)); + } + + jsdata = result; + } + else if (dynamic_cast^>(netdata) != nullptr) + { + v8::Local result = Nan::New(); + for each (System::Collections::Generic::KeyValuePair^ pair + in (System::Collections::Generic::IDictionary^)netdata) + { + result->Set(pair->Key, ClrFunc::MarshalCLRToV8(pair->Value)); + } + + jsdata = result; + } else if (dynamic_cast(netdata) != nullptr) { v8::Local result = Nan::New(); diff --git a/src/dotnet/nodejsfuncinvokecontext.cpp b/src/dotnet/nodejsfuncinvokecontext.cpp index 20d01ed3..7703eb5b 100644 --- a/src/dotnet/nodejsfuncinvokecontext.cpp +++ b/src/dotnet/nodejsfuncinvokecontext.cpp @@ -62,12 +62,18 @@ NodejsFuncInvokeContext::!NodejsFuncInvokeContext() } } +// for not default domain +#pragma managed(push, off) +static Nan::Persistent callbackFactory; +static Nan::Persistent callbackFunction; +#pragma managed(push, pop) + void NodejsFuncInvokeContext::CallFuncOnV8Thread() { DBG("NodejsFuncInvokeContext::CallFuncOnV8Thread"); - static Nan::Persistent callbackFactory; - static Nan::Persistent callbackFunction; + //static Nan::Persistent callbackFactory; + //static Nan::Persistent callbackFunction; Nan::HandleScope scope; try