Git Product home page Git Product logo

edge-js's People

Contributors

agracio avatar andyrooger avatar corylulu avatar dependabot[bot] avatar domyalexms avatar harunrst avatar hebarusan avatar jsantos98 avatar michael-tajmajer-emrsn avatar orvisevans avatar peter-sabath avatar shferguson-truefit avatar tripheo0412 avatar vsilvar avatar wazzamatazz avatar westonpace avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

edge-js's Issues

Crash when using mono 5.4.x

Since the Tomasz seems to be inactive I post that issue here too.

I am trying to get it running with mono 5.4 and encounter a crash (on MacOS).

This crash originates from the Dictionary::Add method, because the

add = mono_class_get_method_from_name(mono_object_get_class(_this), 
"System.Collections.Generic.IDictionary<string,object>.Add", -1);

call in line 8 returns a NULL pointer. I understand the reason for this, but don't understand why this does not occur under mono 4.8.

The most common usage is with an ExpandoObject which implements System.Collections.Generic.IDictionary<string,object>.Add but unfortunately as private interface using explicit interface implementation. Using reflection clearly shows the method to be private.

The methods can be made visible by explicitly casting an object to the interface. While this works when written in C# I am still not able to get it working with mono embedding.

I request the method from the specific interface class <string, object> and use mono_object_castclass_mbyrefto cast the _this object to one of the interface class but this still does not properly work

My current workaround is an additional static method in MonoEmbedding.cs that gets the object, key & value and makes the operation in C# code, which works, but I am not happy about the switch from native to managed and back which is used many times.

Dictionary.cpp (Changed):

void Dictionary::Add(MonoObject* _this, const char* name, MonoObject* value)
{
    static MonoMethod* add;
    
    if(!add) {
        add = mono_class_get_method_from_name(MonoEmbedding::GetClass(), "AddPropertyToObject", -1);
    }

    void* params[3];
    params[0] = _this;	//dict
    params[1] = mono_string_new(mono_domain_get(), name);	// key
    params[2] = value;	// value

    mono_runtime_invoke(add, _this, params, NULL);
}

monoembedding.cs (Added new method)

    // used for ExpandoObject & IDictionary<string, object> to add values
    static public void AddPropertyToObject( object obj, string propName, object val)
    {
    	var eo = obj as IDictionary<string, object>;
    	if ( eo == null )
    		return;
    		
    	eo.Add(propName, val);
    }

I use it in an electron context, but think this is a general problem of both forks.

Anyone with a better solution?

Nuget builds?

I didn't see a way to grab pre-built binaries for .Net projects. I may just be overlooking the link, but if not would you consider publishing builds of this fork to a Nuget package? You've put a lot of work into bug fixes and features that the original repo hasn't accepted, and I imagine a lot of other .Net developers relying on this would appreciate the option of being able to just pull install your fork rather than having to rebuild the packages each time.

Getting result when calling CLR function.

I am executing JavaScript within a C# environment. One of the parameters has a property that returns a Func<object, Task> which permits the Javascript to call back into C# to get a value:

Edge.Func(@"return function(params, callback) {
    var name = params.name;
    var helper = params.helper;
    helper.GetAge(name, (o, age) => {
        callback(null, age);
    });
}")(new { name = "Chet", helper = new Helper() });

The C# class for Helper is:

public class Helper {
    public Func<object, Task<object>> GetAge {
        get {
            return async obj => {
                var name = (string)obj;
                if (name == "Chet") return 10;
                return 15;
            };
        }
    }
}

If I don't want to use a callback, the value can be assigned into a variable directly, like this:
var age = helper.GetAge(name, true);

I don't understand why true is required? In keeping with typical JavaScript function calls, can't it be assumed that if no callback function is provided then I want to call the function synchronously? Essentially, I think line 29 in ClrFuncInvokeContext.cpp should be changed to

this->Sync = true;

So that if a user doesn't provide a callback function it assumes it is synchronous. As it is right now, it goes into an inconsistent state which eventually throws an exception because it is asynchronous and yet no callback function is provided.

I also raised this issue on the main repo tjanczuk/edge#633

Bootstrap project should build with CopyLocalLockFileAssemblies set to true

Currently, when your run npm install a bunch of DLLs are copied into the user's nuget folders. This can cause issues like #26 and it means, if the root project folder were moved to a different machine without running npm install on the other machine then the code would no longer run (since the other machine would not have the nuget folders).

In the short term this also means that bootstrap won't work on Linux but that can be addressed by #46.

If, instead, the CopyLocalLockFileAssemblies were set to true then the DLLs would be inside the node_modules hierarchy and the bootstrap process would be more portable.

create instance

hi how can i create instance from a class and pass it as parameter when calling a method ?

System.TypeLoadException

I am using os x Sierra and dotnet. I got the following exception when i try to require edge-js

dotnet --version
2.0.0

Unhandled Exception: System.TypeLoadException: Could not load type 'System.Runtime.Loader.AssemblyLoadContext' from assembly 'System.Runtime.Loader, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

Cannot call .NET Core 2.0 dll

When I try to call a .NET core 2.0 dll after setting the environment variable EDGE_USE_CORECLR=1 I get the following error:

PS C:\code\node-edge-test> node .\sample.js

C:\code\node-edge-test\node_modules\edge-js\lib\edge.js:178
    return edge.initializeClrFunc(options);
                ^
Error: Could not load file or assembly 'System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.    at Object.exports.func (C:\code\node-edge-test\node_modules\edge-js\lib\edge.js:178:17)
    at Object.<anonymous> (C:\code\node-edge-test\sample.js:32:36)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3

The exact same code works with a .NET Framework 4.6.1 dll

js:

const path = require('path');
const edge = require('edge-js');
const baseNetAppPath = path.join(__dirname, '\\QuickStartFramework\\QuickStartFramework.Core\\bin\\Debug');
const coreNetAppPath = path.join(__dirname, '\\QuickStart\\QuickStart.Core\\bin\\Debug\\netcoreapp2.0');

process.env.EDGE_USE_CORECLR = 1;
// process.env.EDGE_APP_ROOT = baseNetAppPath;
process.env.EDGE_APP_ROOT = coreNetAppPath;

// const getFrameworkAppDomainDirectory = edge.func({
// 	assemblyFile: path.join(baseNetAppPath, 'QuickStartFramework.Core.dll'),
// 	typeName: 'QuickStartFramework.Core.LocalMethods',
// 	methodName: 'GetAppDomainDirectory'
// });

// getFrameworkAppDomainDirectory('', (e,r) => {
// 	if (e) throw error;
// 	console.log(r);
// });

const getAppDomainDirectory = edge.func({
	assemblyFile: path.join(coreNetAppPath, 'QuickStart.Core.dll'),
	typeName: 'QuickStart.Core.LocalMethods',
	methodName: 'GetAppDomainDirectory'
});

getAppDomainDirectory('', (e,r) => {
	if (e) throw error;
	console.log(r);
});

csharp:

using System;
using System.Threading.Tasks;

namespace QuickStart.Core
{
    public class LocalMethods
    {
        public async Task<object> GetAppDomainDirectory(dynamic input) => AppDomain.CurrentDomain.BaseDirectory;
        public async Task<object> GetLocalDateTime(dynamic input) => DateTime.Now.ToString("yyyy:MM:dd HH:mm:ss");
    }
}

Is there something else I am missing?

node v10.x and ubuntu 16.04

tried to run a app server after upgrading node from v8.x to v10.x and got the following exception:

  SOLINK_MODULE(target) Release/obj.target/edge_coreclr.node
  COPY Release/edge_coreclr.node
  ACTION binding_gyp_build_managed_target_restore_bootstrap_packages lib/bootstrap/project.lock.json
Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
  http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
build_managed.target.mk:13: recipe for target 'lib/bootstrap/project.lock.json' failed
make: *** [lib/bootstrap/project.lock.json] Error 145
make: Leaving directory '/[local-path]/server-hosts/node_modules/edge-js/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Linux 4.4.0-137-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /[local-path]/server-hosts/node_modules/edge-js
gyp ERR! node -v v10.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.

on (re)install. I checked, the edge_coreclr.node and edge_nativeclr.node were generated. When run, the following runtime error was encountered:

ubuntu-d-64:/[local-path]/server-hosts$ node app.js
Stacktrace:

/proc/self/maps:
00400000-022a1000 r-xp 00000000 08:01 958084                             /usr/bin/node
024a0000-024a1000 r--p 01ea0000 08:01 958084                             /usr/bin/node
024a1000-024b7000 rw-p 01ea1000 08:01 958084                             /usr/bin/node
024b7000-024d1000 rw-p 00000000 00:00 0 
04396000-046a8000 rw-p 00000000 00:00 0                                  [heap]
41990000-419a0000 rwxp 00000000 00:00 0 
41b25000-41b35000 rwxp 00000000 00:00 0 
be6bc00000-be6bc80000 rw-p 00000000 00:00 0 
11ac1180000-11ac1200000 rw-p 00000000 00:00 0 
23aa8480000-23aa8500000 rw-p 00000000 00:00 0 
34def180000-34def200000 rw-p 00000000 00:00 0 
492f8800000-492f8880000 rw-p 00000000 00:00 0 
74920f80000-74921000000 rw-p 00000000 00:00 0 
7f890280000-7f890300000 rw-p 00000000 00:00 0 
83cd7580000-83cd7600000 rw-p 00000000 00:00 0 
859a4cf6000-859a4cf8000 ---p 00000000 00:00 0 
859a4cf8000-859a4d00000 rw-p 00000000 00:00 0 
859a4d00000-859a4d02000 ---p 00000000 00:00 0 
949e9f00000-949e9f80000 rw-p 00000000 00:00 0 
b4819000000-b4819039000 rw-p 00000000 00:00 0 
be8ec080000-be8ec100000 rw-p 00000000 00:00 0 
e2be0280000-e2be0300000 rw-p 00000000 00:00 0 
e3eb9f00000-e3eb9f80000 rw-p 00000000 00:00 0 
f2c22e00000-f2c22e80000 rw-p 00000000 00:00 0 
104bb6500000-104bb6580000 rw-p 00000000 00:00 0 

Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object

By the way, I had both mono 5.16 and .net core 2.1 installed on the Ubuntu box. And the Windows 10 (64bit, node 10.12) version of edge-js works as expected.

Is support for node 10.x on Linux still lacking or is it a bug somewhere? It's about to becomre LTS. I noticed that node 10 is not listed in the release package ...

Lazy symbol binding failed

I get the below error when trying to run the hello world example.
NodeJS: 8.2.1
Mono: 4.2.4
.NET Core 2.0

Everything installed fine. Any insight as to whats causing this?

dyld: lazy symbol binding failed: Symbol not found: _mono_config_parse
Referenced from: /Users/jimmywestcott/GitHub/Quorum/Quorum-seed/node_modules/edge-js/build/Release/edge_nativeclr.node
Expected in: flat namespace

On npm install edge-js loops through all nuget feeds in the config

Hello there! In my project directory I have a nuget.config that holds a private nuget feed and the official nuget.org one. The problem is that edge-js seems to loop through all feeds from the nuget.config when it tries to restore its packages (on npm install) but it stumbles on the private feed, cannot access it and fails. I don't see any reason for edge-js to try to access any other nuget feed except the official one.

Deserialize dynamic input to strongly typed c# object

Is there any method or example of automatically deserializing the dynamic input parameters to an object we can define in c#? perhaps a library like JSON.NET or similar that can be plugged in?

public async Task<object> MyMethod(dynamic input)
{
    //Want to deserialize "input" to a real object
    //something like...
    var myObject = Deserialize<MyType>(input);
}

Why I use callback method to call C# functions still freeze UI?

var TurnPasswordOn = edgejs.func({
    assemblyFile: XXX.dll',
    typeName: 'ABCDEFG',
    methodName: "TurnPasswordOn"
});

TurnPasswordOn(TurnPasswordOnInfo, function(err, ret){
                    if(err)
                    {
                        throw err;
                    }
                    if(ret == true)
                    {
                        alert("Set password success");
                    }
                    else
                    {
                        alert("Set password fail");
                    }
 });

Because the TurnPasswordOn function needs to take about 30~40 seconds, I want to do a loader animation.

But when the code executes to TurnPasswordOn function, it freezes the UI.
The loader animation is frozen (not going).
I'm just curious why I use callback function, but it still freezes the UI?

Thanks for helping.

Return promises from func invocations?

I am just doing a spike using edge js and one thing I noticed odd is that it supports ES6 template literals for code, but doesnt seem to return/use ES6 promises from the func handlers returned?

i.e I would expect something like:

const handler = edge.func(`...`);
handler()
   .then(result => console.log("got", result))
   .catch(console.error);

If it returned a promise it also opens up use cases for async/await like:

const handler = edge.func(`...`);
const result = await handler();

Is there any technical reason why Promises are not used?

Packages in ~/.nuget cannot be resolved in Linux

There are a number of #if EDGE_PLATFORM_NIX statements in deps_entry.cpp which control lowercasing path names. However, in deps_entry.h there is the following code:

#if EDGE_PLATFORM_NIX
#include "../edge.h"
#endif

The problem is EDGE_PLATFORM_NIX will only be defined if edge.h is already loaded. Since it is not defined then edge.h is not loaded and EDGE_PLATFORM_NIX is never defined.

If I remove the #if from deps_entry.h then everything starts working on Linux. However, I am presuming it was put in there for a reason and I don't know that reason so I'm not sure what a proper fix would be.

Azure Web App System.AccessViolationException

Whenever I upload new version of my application on application reloading I got this error:

Application: w3wp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
   at EdgeJs.Edge.NodeStartx86(Int32, System.String[])
   at EdgeJs.Edge+<>c__DisplayClass14_0.<Func>b__0()
   at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.ThreadHelper.ThreadStart()

After that w3wp process restart itself and everything works again.

The same problem I have with IISExpress during development. The same error kills my IISExpress process on every new build.

Module did not self-register

node v-10.6.0; 报一下错误,这是怎么回事?

internal/modules/cjs/loader.js:760 Uncaught Error: Module did not self-register.
at Object.Module._extensions..node (internal/modules/cjs/loader.js:760:18)
at Module.load (internal/modules/cjs/loader.js:623:32)
at tryModuleLoad (internal/modules/cjs/loader.js:562:12)
at Function.Module._load (internal/modules/cjs/loader.js:554:3)
at Module.require (internal/modules/cjs/loader.js:661:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (G:\work\zhilan\nwjs-sdk-v0.31.5-win-x64\node_modules\edge-js\lib\edge.js:54:8)
at Module._compile (internal/modules/cjs/loader.js:713:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:730:10)
at Module.load (internal/modules/cjs/loader.js:623:32)

Don't include unused files in published npm package

It seems like we should be able to add an .npmignore file for a bunch of files in this package, which would (1) reduce the size of the package, and (2) stop Visual Studio Code from showing warnings about how the sample code is setup.

I'm thinking something like the following, let me know if you're interested in a PR:

.gitattributes
.jshintrc
Dockerfile
LICENSE
*.md
*.yml
*.ts
performance/
samples/
src/
stress/
test/
tools/

Does that sound right?

Unable to load DLL 'node.dll' when running using x86 configuration

I am using EdgeJS 9.3.4 in my Unit Tests, when I run the tests using x64 configuration, it works fine but when I run using x86 build configuration, it gives error:

An unhandled exception of type 'System.DllNotFoundException' occurred in EdgeJs.dll
Unable to load DLL 'node.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

The edge folder is being copied to the bin folder and it has the node.dll in the x86 folder.

AspNetCore 2.0

Hi!

In the readme there is an example -> "You can also script Node.js from C#:"
Is this also possible from AspNetCore 2.0 or only from .Net Framework 4.5+?

Where does Console.WriteLine output go?

In vscode running a Javascript app which uses edge-js to call C# code, where does Console.WriteLine output go? Not in vscode's Debug Console or Output windows.

Conceptual Question about Multi-threading Support Using IIS and Edge

If I have a .NET service application running from IIS that exposes API endpoints and the controller actions for the endpoints execute functions in Node.js would each node function call be executed in a separate thread, and if so would each thread be separate from the calling C# thread (as was my impression from the documentation)? Assuming that the answer is yes, can we then say that the number of node processes executing in parallel is limited only by the size of the threadpool from the IIS application, since that is the parent process?

Apologies if this is a silly question. I am trying to the confirm the feasibility of using C# and Node.js together via Edge.js for the rapid development of a small cloud-based API that calls CPU-intensive code. The intent is for the API to initially operate at a small initial scale (~10 req/sec) with minimalist infrastructure (1 vCPU and 1 GB), with the goal of eventually growing to a larger scale (~50 req/sec) with larger infrastructure (2 vCPU and 4 GB).

Can't build for node 10.

Hi,

Tried to build it for node 10.13.0 without success.
Used VS 2017 prompt and run the following command:

build release 10.13.0

This is what I get:

gyp ERR! build error
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\al_\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Work\\STServer\\Server\\node_modules\\edge-js\\lib\\native\\win32\\x64\\10.13.0\\node.exe" "C:\\Users\\al_\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "build" "--msvs_version=2017" "-release"
gyp ERR! cwd C:\Work\STServer\Server\node_modules\edge-js
gyp ERR! node -v v10.13.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Error building edge.node release for node.js x64 v10.13.0

I can build for node 8, but not for node 10.
Any ideas?

Thanks,

Alex

Edge-js + NWJS error: Module did not self-register

Hello everybody.

I'm having an issue trying to use edge-js with nwjs. I'm using edge-js because nwjs uses node 9.1.0(nwjs version 0.26.6) and only edge-js supports that node version, right ? It builds very well by that given node version but when I perform require("edge-js") it gives me the error:

Module did not self-register.

The same code I could get to work in a separate project (pure nodejs code, outside nwjs). It seems to be something with architecture mismatch, but when I look into node_modules\edge-js\lib\native\win32\ there is libs built both for ia32 and x64 for that node version(9.1.0).

Is it possible to, when the app does require the package it is referencing a wrong lib? Or, if that error can address to another kind of issues, what it could then ?

Thank in adv.

Trying to run within node-webkit fails

Thanks for putting edge-js up, I am using it with node 8.x.

I tried to use it with nw.js (node-webkit) but i get an error :
uncaught Error: Invalid access to memory location.
\?\C:\temp\nw\sample\node_modules\edge-js\lib\native\win32\x64\8.1.2\edge_nativeclr.node
at Object.Module._extensions..node (module.js:640:18)
at Module.load (module.js:527:32)
at tryModuleLoad (module.js:490:12)
at Function.Module._load (module.js:482:3)
at Module.require (module.js:537:17)
at require (internal/module.js:11:18)
at Object. (C:\temp\nw\sample\node_modules\edge-js\lib\edge.js:53:8)
at Module._compile (module.js:593:30)
at Object.Module._extensions..js (module.js:610:10)
at Module.load (module.js:527:32)

Any idea how to solve this ?
Thanks.

Edge.Func(...) hangs when running/debugging app in linked folder

Using Edge.js.8.2.1 I can reliably reproduce a hanging Edge.Func(...) call when running/debugging my executable through a linked folder. Since our build setup depends on symlinks this is kind of a big deal for us. E.g.:

Have:

c:\bin\ConsoleAppUsingEdgeJS.exe
c:\bin\edgejs.dll
c:\bin\edgejs\...
d:\symlink2bin\

Now run:

c:\bin\ConsoleAppUsingEdgeJS.exe           <-- all good
d:\symlink2bin\ConsoleAppUsingEdgeJS.exe   <-- hangs

Similar in VS2015 Project for ConsoleAppUsingEdgeJS when debugging:

if exe was build with build output path set to c:\bin\          <-- all good while debugging
if exe was build with build output path set to d:\symlink2bin\  <-- Edge.Func never returns

Is there any workaround that makes symlinks work? Or any hint what the issue could be?

ASP.NET MVC crashing IIS with Event 5011 in Event Viewer

Running the supplied example:

var func = Edge.Func(@"
                    return function (data, callback) {
                        callback(null, 'Node.js welcomes ' + data);
                    }
                "); // crashes here

using version 9.3.2/64-bit. VS2017.

A process serving application pool 'DefaultAppPool' suffered a fatal communication error with the Windows Process Activation Service. The process id was '6448'. The data field contains the error number.

Been trying to get this working for some time. If anyone has any advice, I would appreciate.

thanks!

Debugging does not work for pre-compiled .NET Core assemblies under Windows

First of all... thank you for maintaining this fork and also for creating the quick start project! It got me running quickly after some extended frustration with the main fork (tjanczuk).

However, it appears that debugging C# code is not working as implied by the readme, at least under .NET Core and MS Windows.

To see the issue:

  1. Modify your Quick Start app so there's time to attempt attaching a debugger. In main.js, after the calls into edge.func(), and before the line that begins logging calls to "local methods", add something like this...

console.log('Initialized on PID ' + process.pid + '... will initiate tests in 20 seconds...');
setTimeout(function(){
// ... leave all the calls in the quick start verbatim here, e.g....
console.log('### Calling local methods from ' + namespace +'.dll')
...
// ... but then at the bottom of the file add ...
}, 20000);

  1. Open QuickStart.Core.csproj in VS2017 on Windows, and place debugger breakpoints in all the methods in LocalMethods.cs. Also place breakpoints on the methods in ExternalLibrary\Library.cs.

  2. Start the quick start in node.js. When it gives you the correct PID...

  3. Switch back to VS2017 and do Ctrl+Alt+P to attach the debugger to a process. Choose the right instance of Node. Note: you will need to click the Select button and tell it to debug "Managed (CoreCLR) code".

  4. Watch what happens when the 20 seconds passes and stuff starts executing.

Unexpected: execution never breaks on the breakpoints in QuickStart.Core\LocalMethods.cs. It does break in ExternalLibrary.cs, but when it does, the stuff in QuickStart.Core is not even on the call stack. (The call stack appears empty.)

Expected result: execution would stop on the breakpoints in both QuickStart.Core\LocalMethods.cs AND in ExternalLibrary\Library.cs.

Based on the documentation, this does not seem like expected behavior. My apologies if I missed something. It would be extremely useful if one could interactively debug the code in whichever type is loaded directly by Edge, rather than only being able to debug additional assemblies loaded indirectly.

Can't call .NET code from JavaScript running in .NET app.

I can't make it work in this scenario when I need to run C# helper functions from JavaScript code running inside a .NET application.
The JavaScript throws the exception "Error: Cannot find module 'edge-js'" in the line
var edge = require('edge-js');
I understand why it complaints, I just don't know what to do to make it work.
Here is a simple console app to reproduce the issue:

using System;
using System.Threading.Tasks;
using EdgeJs;
namespace EdjeJsConsoleApp
{
class Program
{
public static async Task Start()
{
var func = Edge.Func(@"
var edge = require('edge-js');
var createHello = edge.func(function () {/*
async (input) =>
{
return (Func<object,Task>)(async (i) => {
Console.WriteLine(""Hello from .NET"");
return null;
});
}
*/});
return function (data, cb) {
var hello = createHello(null, true);
hello(null, true); // prints out ""Hello from .NET""
cb(null, 'Node.js ' + process.version + ' welcomes ' + data);
}"
);
Console.WriteLine(await func(".NET"));
}
static void Main(string[] args)
{
Start().Wait();
}
}
}

System.BadImageFormatException from pre-built binaries

Hi, I am trying your fork to see if it fixes the System.AccessViolationException for ASP.Net Web applications. I am unable to get your pre-built binaries to work on a fresh ASP.Net MVC project.

Could not load file or assembly 'EdgeJs' or one of its dependencies. An attempt was made to load a program with an incorrect format.

I am guessing the error is due to conflicts between target framework or system architecture but I don't really know.

I tried compiling the source on my own machine but was unsuccessful.

I am using the pre-build binaries from your v9.0.0 release.

BTW, thank you for your effort to try to keep this project moving along!

CoreCLR error: Unsupported object type received from the CLR: 12

I've ran across a sporadic error in the CoreCLR version of EdgeJS when calling .Net from Javascript. Occasionally it will report an error on the Javascript side of Unsupported object type received from the CLR: 12 and then will crash node with an unhandled CLR exception: Unsupported marshalled data type: 12.

Data type 12 is V8Type.Task in corecrlembedding.cs. It appears that there is a race condition in the CoreCLREmbedding::CallFunc() method. It's possible for the check on functionTask.IsCompleted to be false, but for functionTask.Status in the else case to return TaskStatus.RanToCompletion. This causes the unsupported object type error because edge assumes that when the value it gets back when TaskStatus.RanToCompletion is the Task's result. But in this case it is the Task object itself.

You'd think that this a really slim race condition, but we're making enough JS to CS calls that we're hitting it in our project regularly.

The code below will eventually reproduce the issue creating a task that will complete asynchronously at random times. It may take several minutes, but on my machine it will consistently reproduce.

process.env.EDGE_USE_CORECLR=1;

var edge = require('edge-js');

var test = edge.func(function() { /*
    #r "System.Runtime.Extensions.dll"
    using System;
    using System.Diagnostics;
    using System.Threading;
    using System.Threading.Tasks;

    class Startup {
        public Task<object> Invoke(object args) {
            var sw = new System.Diagnostics.Stopwatch();
            var waitMs = new Random().Next(0, (int)(System.Diagnostics.Stopwatch.Frequency / 1000));
            return Task.Run(() => {
                sw.Start();
                while (sw.ElapsedTicks < waitMs) { }
                return (object)sw.ElapsedTicks;
            });
        }
    }
*/});

function doTest() {
    try {
        test(null, doTest);
    } catch (e) {
        console.log(e);
    }
}

doTest();

var done = (function wait () { if (!done) setTimeout(wait, 1000) })();

Can't build for Node.js 9.11.1

node: 9.11.1
node-gyp: v3.8.0
edge-js: 10.3.1
Windows 7 x64

node-gyp configure --target=9.11.1 --msvs_version=2015
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info spawn C:\Users\usuario.windows-build-tools\python27\python.EXE
gyp info spawn args [ 'C:\Users\usuario\AppData\Roaming\nvm\v9.11.1\node_modules\node-gyp\gyp\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-G',
gyp info spawn args 'msvs_version=2015',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\usuario\nw-edge-js\node_modules\edge-js\build\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\usuario\AppData\Roaming\nvm\v9.11.1\node_modules\node-gyp\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\usuario\.node-gyp\9.11.1\include\node\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\Users\usuario\.node-gyp\9.11.1',
gyp info spawn args '-Dnode_gyp_dir=C:\Users\usuario\AppData\Roaming\nvm\v9.11.1\node_modules\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\Users\usuario\.node-gyp\9.11.1\<(target_arch)\node.lib',
gyp info spawn args '-Dmodule_root_dir=C:\Users\usuario\nw-edge-js\node_modules\edge-js',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'C:\Users\usuario\nw-edge-js\node_modules\edge-js\build',
gyp info spawn args '-Goutput_dir=.' ]
Warning: while converting VCCLCompilerTool/BasicRuntimeChecks to MSBuild, index value (-1) not in expected range [0, 4)
Warning: while converting VCCLCompilerTool/RuntimeTypeInfo to MSBuild, expected bool; got '-1'
Warning: while converting VCCLCompilerTool/RuntimeLibrary to MSBuild, index value (-1) not in expected range [0, 4)
Warning: while converting VCCLCompilerTool/RuntimeTypeInfo to MSBuild, expected bool; got '-1'
Warning: while converting VCCLCompilerTool/BasicRuntimeChecks to MSBuild, index value (-1) not in expected range [0, 4)
Warning: while converting VCCLCompilerTool/BasicRuntimeChecks to MSBuild, index value (-1) not in expected range [0, 4)
Warning: while converting VCCLCompilerTool/RuntimeTypeInfo to MSBuild, expected bool; got '-1'
Warning: while converting VCCLCompilerTool/RuntimeLibrary to MSBuild, index value (-1) not in expected range [0, 4)
Warning: while converting VCCLCompilerTool/RuntimeTypeInfo to MSBuild, expected bool; got '-1'
Warning: while converting VCCLCompilerTool/BasicRuntimeChecks to MSBuild, index value (-1) not in expected range [0, 4)
gyp info ok

node-gyp build --target=9.11.1 --msvs_version=2015

..\src\CoreCLREmbedding\coreclrfuncinvokecontext.cpp(90): warning C4996: 'Nan::Callback::Call': was declared deprecated [C:\Users\usuario\nw-edge-js\node_modules\edge-js\build\edge_coreclr.vcxproj]
C:\Users\usuario\nw-edge-js\node_modules\nan\nan.h(1655): note: see declaration of 'Nan::Callback::Call'
coreclrnodejsfuncinvokecontext.cpp
utils.cpp
pal_utils.cpp
trace.cpp
fx_ver.cpp
fx_muxer.cpp
json.cpp
json_parsing.cpp
c:\users\usuario\nw-edge-js\node_modules\edge-js\src\coreclrembedding\fxr../host/libhost.h(19): warning C4099: 'fx_ver_t': type name first seen using 'struct' now seen using 'class' (compiling source file ..\src\CoreCLREmbedding\fxr\fx_ muxer.cpp) [C:\Users\usuario\nw-edge-js\node_modules\edge-js\build\edge_coreclr.vcxproj]
c:\users\usuario\nw-edge-js\node_modules\edge-js\src\coreclrembedding\host../fxr/fx_ver.h(12): note: see declaration of 'fx_ver_t' (compiling source file ..\src\CoreCLREmbedding\fxr\fx_muxer.cpp)
json_serialization.cpp
asyncrt_utils.cpp
deps_format.cpp
deps_entry.cpp
deps_resolver.cpp
args.cpp
coreclr.cpp
c:\users\usuario\nw-edge-js\node_modules\edge-js\src\coreclrembedding\host\libhost.h(19): warning C4099: 'fx_ver_t': type name first seen using 'struct' now seen using 'class' (compiling source file ..\src\CoreCLREmbedding\deps\deps_reso lver.cpp) [C:\Users\usuario\nw-edge-js\node_modules\edge-js\build\edge_coreclr.vcxproj]
c:\users\usuario\nw-edge-js\node_modules\edge-js\src\coreclrembedding\host../fxr/fx_ver.h(12): note: see declaration of 'fx_ver_t' (compiling source file ..\src\CoreCLREmbedding\deps\deps_resolver.cpp)
libhost.cpp
c:\users\usuario\nw-edge-js\node_modules\edge-js\src\coreclrembedding\host\libhost.h(19): warning C4099: 'fx_ver_t': type name first seen using 'struct' now seen using 'class' (compiling source file ..\src\CoreCLREmbedding\host\args.cpp) [C:\Users\usuario\nw-edge-js\node_modules\edge-js\build\edge_coreclr.vcxproj]
c:\users\usuario\nw-edge-js\node_modules\edge-js\src\coreclrembedding\host../fxr/fx_ver.h(12): note: see declaration of 'fx_ver_t' (compiling source file ..\src\CoreCLREmbedding\host\args.cpp)
runtime_config.cpp
pal.windows.cpp
c:\users\usuario\nw-edge-js\node_modules\edge-js\src\coreclrembedding\host\libhost.h(19): warning C4099: 'fx_ver_t': type name first seen using 'struct' now seen using 'class' (compiling source file ..\src\CoreCLREmbedding\host\libhost.c pp) [C:\Users\usuario\nw-edge-js\node_modules\edge-js\build\edge_coreclr.vcxproj]
c:\users\usuario\nw-edge-js\node_modules\edge-js\src\coreclrembedding\host../fxr/fx_ver.h(12): note: see declaration of 'fx_ver_t' (compiling source file ..\src\CoreCLREmbedding\host\libhost.cpp)
..\src\CoreCLREmbedding\host\runtime_config.cpp(41): warning C4996: 'web::json::value::to_string': This API is deprecated and has been renamed to avoid confusion with as_string(), use ::web::json::value::serialize() instead. [C:\Users\us uario\nw-edge-js\node_modules\edge-js\build\edge_coreclr.vcxproj]
C:\Users\usuario\nw-edge-js\node_modules\edge-js\src\CoreCLREmbedding\json\casablanca\include\cpprest/json.h(431): note: see declaration of 'web::json::value::to_string'
Creating library C:\Users\usuario\nw-edge-js\node_modules\edge-js\build\Release\edge_coreclr.lib and object C:\Users\usuario\nw-edge-js\node_modules\edge-js\build\Release\edge_coreclr.exp
Generating code
All 4413 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
Finished generating code
edge_coreclr.vcxproj -> C:\Users\usuario\nw-edge-js\node_modules\edge-js\build\Release\edge_coreclr.node
edge_coreclr.vcxproj -> C:\Users\usuario\nw-edge-js\node_modules\edge-js\build\Release\edge_coreclr.pdb (Full PDB)
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\usuario\AppData\Roaming\nvm\v9.11.1\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:180:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\node-gyp\bin\node-gyp.js" "build" "--target=9.11.1" "--msvs_version=2015"
gyp ERR! cwd C:\Users\usuario\nw-edge-js\node_modules\edge-js
gyp ERR! node -v v9.11.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

C:\Users\usuario\nw-edge-js\node_modules\edge-js (master -> origin) ([email protected])

Building with node v8.9.0(LTS)

I'm trying to build with using node v8.9.0 and am getting an error when trying to run:
"%NODEEXE%" "%GYP%" configure --msvs_version=2017

With Node v8.2.1, I can use:
"%NODEEXE%" "%GYP%" configure --msvs_version=2015

But, node 8.9.0 fails with "cannot convert argument 1 from 'nullptr' to 'nullptr &&'" -- I suspect that I need 2017 for newer versions of node.

Are there any additional setup steps not listed in the markdown needed to build for VS2017 && newer versions of node?

Error from "%NODEEXE%" "%GYP%" configure --msvs_version=2017

gyp info spawn args 'D:\Working\edge-js\build',
gyp info spawn args '-Goutput_dir=.' ]
Traceback (most recent call last):
File "C:\Users\Emerson\AppData\Roaming\npm\node_modules\node-gyp\gyp\gyp_main.py", line 16, in
sys.exit(gyp.script_main())
File "C:\Users\Emerson\AppData\Roaming\npm\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 545, in script_main
return main(sys.argv[1:])
File "C:\Users\Emerson\AppData\Roaming\npm\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 538, in main
return gyp_main(args)
File "C:\Users\Emerson\AppData\Roaming\npm\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 514, in gyp_main
options.duplicate_basename_check)
File "C:\Users\Emerson\AppData\Roaming\npm\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 98, in Load
generator.CalculateVariables(default_variables, params)
File "C:\Users\Emerson\AppData\Roaming\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1916, in CalculateVariables
generator_flags.get('msvs_version', 'auto'))
File "C:\Users\Emerson\AppData\Roaming\npm\node_modules\node-gyp\gyp\pylib\gyp\MSVSVersion.py", line 434, in SelectVisualStudioVersion
versions = _DetectVisualStudioVersions(version_map[version], 'e' in version)
KeyError: '2017'
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Users\Emerson\AppData\Roaming\npm\node_modules\node-gyp\lib\configure.js:336:16)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\Emerson\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--msvs_version=2017"
gyp ERR! cwd D:\Working\edge-js
gyp ERR! node -v v8.9.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

App pool crashes when calling NodeJS from CLR

I'm getting this error in the simple sample:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt
at EdgeJs.Edge.NodeStartx64(Int32 argc, String[] argv)
at EdgeJs.Edge.<>c__DisplayClass14_0.b__0()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

What's interesting though, is if I restart the app pool, it starts working. But if i change something, and do a build again, without stopping the app pool in the meantime, it will crash again, and to make it work again, I need to restart the app pool.

Le me know, if you know about this issue, and how can I help to find the issue.

Memory leak

Hello I have a "little" problem with the ram consumption of a very simple example:

var edge = require('edge-js');

var addAndMultiplyBy2 = edge.func(function () {/*
    async (dynamic input) => {
        var add = (Func<object, Task<object>>)input.add;
        var twoNumbers = new { a = (int)input.a, b = (int)input.b };
        var addResult = (int)await add(twoNumbers);
        return addResult * 2;
    }   
*/});

var payload = {
    a: 2,
    b: 3,
    add: function (data, callback) {
        callback(null, data.a + data.b);
    }
};

function work() {
    for (let i = 0; i < 65536 * 16; i++) {
        addAndMultiplyBy2(payload, function (error, result) {
            if (error) throw error;
        });
    }
}

work();

setTimeout(() => {}, 50000);

The ram consumption goes up to about 2GO then never get down until the program closes.
image

Did I do something wrong, or is there a memory leak?
I use Node V8.10.0 and edge-js 9.3.5

Error using special character in the EDGE_APP_ROOT environment variable

If we use a special character(eg:-åäö) in the EDGE_APP_ROOT path, the edge library throw following exception.

Could not find a part of the path 'D:{folderpath}\agracio-edge-js-quick-start\srcä\QuickStart.Core\bin\Debug\netcoreapp2.0\QuickStart.Core.deps.json'.
at Object.Module._extensions..node (module.js:598:18)
at Module.load (module.js:488:32)

We found this issue in a customer environment where she has %USERPROFILE% folder with special characters because some of these characters are part of her name.

Repro Steps:

  1. Clone https://github.com/agracio/edge-js-quick-start
  2. Install dependencies npm install
  3. Build QuickStart.Core (cd src\QuickStart.Core & dotnet build )
  4. npm run start:core
    This should run successfully.
  5. Now rename src folder to srcä
  6. Set line 6 of main.js to
    const baseNetAppPath = path.join(__dirname, '/srcä/'+ namespace +'/bin/Debug/net'+ version +'2.0');
  7. npm run start:core
    It gives following error.

module.js:598
return process.dlopen(module, path._makeLong(filename));
^
Error: Could not find a part of the path 'D:\r\Repo\agracio-edge-js-quick-start\srcä\QuickStart.Core\bin\Debug\netcoreapp2.0\QuickStart.Core.deps.json'.
at Object.Module._extensions..node (module.js:598:18)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (D:\r\Repo\agracio-edge-js-quick-start\node_modules\edge-js\lib\edge.js:54:8)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)

Investigation:
It looks like issue marshaling the BootstrapperContext. I can see in the debugger that two byte character converted as two letters in following structure instead of single letter. So subsequent file lookup fails with above exception.

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct EdgeBootstrapperContext
{
    [MarshalAs(UnmanagedType.LPStr)]
    public string RuntimeDirectory;

    [MarshalAs(UnmanagedType.LPStr)]
    public string ApplicationDirectory;

    [MarshalAs(UnmanagedType.LPStr)]
    public string DependencyManifestFile;
}

Any help regarding how to resolve this is realy appreciated.

can not use electron-edge-js OR edge-js using electron, webpack, typescript.

I am trying to create a simple base project of electron and edge-js in renderer process from scratch.
I also tried using electron-edge-js in main process.

folder structure

.
├── public
│   ├── index.html
├── src
│   ├── main
|       └── app.ts
│   ├── renderer
│       └── main.ts
├── packag.json
├── webpack.config.js
└── tsconfig.json

index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div class="mainapp"></div>
    <script src="../dist/renderer/main.js"></script>
</body>
</html>

app.ts

import { app, BrowserWindow } from 'electron';
import path from 'path';

let win;

app.on('ready',() => {
    win = new BrowserWindow({});
    win.loadURL(`file://${app.getAppPath()}/public/index.html`);
});

main.ts

var edge = require('edge-js');

var helloWorld = edge.func(`
    async (input) => { 
        return ".NET Welcomes " + input.ToString(); 
    }
`);

console.log('JavaScript', function (error:any, result:any) {
    if (error) throw error;
    console.log(result);
});

package.json

{
  "name": "somethig",
  "version": "1.0.0",
  "description": "",
  "main": "dist/main/app.js",
  "scripts": {
    "build": "webpack",
    "prestart": "webpack",
    "start": "electron ."
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "edge-js": "^9.3.5",
    "electron-edge-js": "^8.3.2",
    "react": "^16.3.2",
    "react-redux": "^5.0.7",
    "redux": "^4.0.0",
    "tslib": "^1.9.0"
  },
  "devDependencies": {
    "awesome-typescript-loader": "^5.0.0",
    "electron": "^2.0.0",
    "source-map-loader": "^0.2.3",
    "typescript": "^2.8.3",
    "webpack": "^4.7.0",
    "webpack-cli": "^2.1.2",
    "webpack-node-externals": "^1.7.2"
  }
}

webpack.config.js

var path = require('path');
var webpack = require('webpack');
var nodeExternals = require('webpack-node-externals');

var mainConfig = {
    entry: "./src/main/app.ts",
    target: "electron-main",
    output: {
        filename: "app.js",
        path: path.resolve(__dirname, "dist/main")
    }
};

var rendererConfig = {
    entry: "./src/renderer/main.ts",
    target: "electron-main",
    output: {
        filename: "main.js",
        path: path.resolve(__dirname, "dist/renderer")
    }
};

var commonConfig = {
    mode: "production",
    resolve: {
        extensions: ["."]
    },
    externals: [nodeExternals()],
    module: {
        rules: [
            {
                test: /.tsx?$/,
                loader: "awesome-typescript-loader"
            },
            {
                test: /.js$/,
                loader: "source-map-loader"
            }
        ]
    }
}

module.exports = [Object.assign({},mainConfig,commonConfig),Object.assign({},rendererConfig,commonConfig)];

tsconfig.json

{
  "compilerOptions": {
    "target": "es2016",
    "module": "commonjs",
    "importHelpers": true,
    "strict": true,
    "esModuleInterop": true
  }
}
node -v
v8.11.1

npm -v
6.0.0

Thanks in advance

A parameter initializer is only allowed in a function or constructor implementation.

Hi! when I ran tsc command in my project I got the next error:

node_modules/edge-js/edge-js.d.ts(2,36): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
services/PinPadService.ts(47,31): error TS2554: Expected 2 arguments, but got 1.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] tsc: "tsc --project tsconfig.json"
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] tsc script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Alejandro\AppData\Roaming\npm-cache\_logs\2018-05-18T18_26_28_672Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: "npm run tsc"
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Alejandro\AppData\Roaming\npm-cache\_logs\2018-05-18T18_26_28_716Z-debug.log

My project is with node v8.11, windows 10

How I can fix that problem?

webpack missing module

It seems like webpack can't find type definitions for the package, but I'm not sure why it needs any.
I have a server.ts file, which has a simple hello world edge.js proxy function. I bundle the file using webpack, and it is completed successfully. But the bundled file has "webpackMissingModule" error at the import.
bundle.js

edge = !(function webpackMissingModule() { var e = new Error("Cannot find module ".""); e.code = 'MODULE_NOT_FOUND'; throw e; }());

Please suggest a fix for this.

Application has thrown an uncaught exception and is terminated:
Error: Cannot find module "."
at webpackMissingModule

.net standard (possible?) issue

I have seen a few threads in here and they all point to the quick start apps (of both edge and edge + electron variety).

Now I have followed those as far as I can tell i.e

export const assemblyDir = `${path.resolve(process.cwd(), "dist/assemblies")}`;

process.env.EDGE_USE_CORECLR = <any>1;
process.env.EDGE_APP_ROOT = assemblyDir;

import {func} from "electron-edge-js";

This all works fine for simple use cases, but when I start referencing .net standard dlls (2.0) it starts falling over with errors like:

error CS0012: The type 'System.Object' is defined in an assembly that is not referenced. 
You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.

I noticed that there are a few threads specifically around .net standard but most of them either point to your quick start (which was referenced for this) or just mention you need to include all dependent DLLs for the dll you are trying to import.

So I have done as mentioned in the quick start and made sure I add the relevant bits in the csproj to output all the relevant dlls etc and have them in the same dir as the assembly that is loaded. That didnt work, I also added some config to tell it to output the underlying dlls like netstandard.dll etc and they come out in a ref folder, tried adding that too as well as just dumping ALL of the contents of those folders into the same one, still same issue.

Here is what the csproj currently looks like:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <PreserveCompilationContext>true</PreserveCompilationContext>
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.7.0" />
    <PackageReference Include="NETStandard.Library" Version="2.0.0" />
  </ItemGroup>

</Project>

I have added the PreserveCompilationContext and the PackageReference to NETSTandard.Library just to see if I could get it working, but am at a loss.

So was wondering if you have seen anything like this before?

I am assuming that:

  • I am telling it to use CoreCLR correctly (is there any way to confirm it is using that on the output?)
  • I am providing the relevant dependencies for my dll

Any help or advice would be great, and I am sure this is an issue with me not the project but am at a bit of a loss as to where to turn.

error CS0006: Metadata file 'JobTrackerAPI5.dll' could not be found

Error: Unable to compile C# code.
----> Errors when compiling as a CLR library:
error CS0006: Metadata file 'JobTrackerAPI5.dll' could not be found
error CS0006: Metadata file 'JobTrackerAPI5.dll' could not be found
----> Errors when compiling as a CLR async lambda expression
error CS0006: Metadata file 'JobTrackerAPI5.dll' could not be found
error CS0006: Metadata file 'JobTrackerAPI5.dll' could not be found

This is my error.

I currently have two event files listening for incoming requests, both of which reference this dll, but only one of them works.
The first event fires right when the webserver fully boots, and it compiles the C# code correctly, referencing this dll without any issue, and returning the expected values. However, the 2nd event fires whenever a document is signed. Once a document is signed the server will communicate with JobTracker by use of this dll provided to interact with their API using C#. But once that event fires, I get the error above.

Here is the code for my "onConnection" event

const edge = require("edge-js");
async function connection(_this) {
    let connectionTest = edge.func({
        source: () => {/*
            #r "JobTrackerAPI5.dll"
            using System;
            using System.Threading.Tasks;
            using System.IO;
            using System.Collections.Generic;
            using System.Linq;
            using System.Text;
            using System.Threading.Tasks;
            using Moraware.JobTrackerAPI5;
            public class Startup
            {
                public async Task<object> Invoke(dynamic input)
                {
                    var newDir = Directory.GetCurrentDirectory() + @"/temp";
                    Environment.CurrentDirectory = (newDir);
                    int jobid = (int)input.id;
                    var DB = (string)input.db;
                    string jobIDString = jobid.ToString();
                    string fileName = newDir + @"/" + @"signed-approval" + jobIDString + @".pdf";
                    var JTURL = "https://" + DB + ".moraware.net/";
                    var UID = (string)input.uid;
                    var PWD = (string)input.pwd;
                    Connection conn = new Connection(JTURL + "api.aspx", UID, PWD);
                    conn.Connect();
                    var job = conn.GetJob(jobid);
                    var jobName = job.JobName;
                    conn.Disconnect();
                    return fileName;
                }
            }
        */},
        references: ["JobTrackerAPI5.dll"]
    });
    connectionTest({id: _this.c.moraware.testJobID, uid: _this.c.moraware.uid, pwd: _this.c.moraware.pwd, db: _this.c.moraware.db}, (error, result) => {
        error 
            ? _this.log.error(`Error while making initial connection to https://${_this.c.moraware.db}.moraware.net:\n${error}`)
            : _this.log.success(`Successfully made initial connection to https://${_this.c.moraware.db}.moraware.net:\n${result}`)
    })
}

module.exports = connection

And here is the code for my "onSignature" event

const edge = require("edge-js");
const s = require("snekfetch")
async function approvalSigned(_this, jobID, dl) {
    let uploadToMoraware = edge.func({
        source: () => {/*
            #r "JobTrackerAPI5.dll"
            using System;
            using System.Threading.Tasks;
            using System.IO;
            using System.Collections.Generic;
            using System.Linq;
            using System.Text;
            using System.Threading.Tasks;
            using Moraware.JobTrackerAPI5;
            public class Startup
            {
                public async Task<object> Invoke(dynamic input)
                {
                    var newDir = Directory.GetCurrentDirectory() + @"\temp";
                    Environment.CurrentDirectory = (newDir);
                    int jobid = (int)input.id;
                    var DB = (string)input.db;
                    string jobIDString = jobid.ToString();
                    string filePath = newDir + @"/" + @"signed-approval" + jobIDString + @".pdf";
                    var JTURL = "https://" + DB + ".moraware.net/";
                    var UID = (string)input.uid;
                    var PWD = (string)input.pwd;
                    Connection conn = new Connection(JTURL + "api.aspx", UID, PWD);
                    conn.Connect();
                    var jf = new JobFile(jobid, "signed-approval.pdf");
                    var fi = new FileInfo(filePath);
                    conn.UploadJobFile(jf, fi, false);
                    conn.Disconnect();
                    return jobIDString;
                }
            }
        */},
        references: [`JobTrackerAPI5.dll`]
    });

    s.get(dl).then(r => {
        fs.writeFile(`${__dirname}/../../temp/signed-approval${jobID}.pdf`, r.body, err => {
            uploadToMoraware({id: jobID, uid: _this.c.moraware.uid, pwd: _this.c.moraware.pwd, db: _this.c.moraware.db}, (error, result) => {
                error 
                    ? _this.log.error(error)
                    : _this.log.success(result)
                fs.unlink(`${__dirname}/../../temp/signed-approval${jobID}.pdf`, err => {
                    err
                        ? _this.log.error(err)
                        : _this.log.success(`Successfully Deleted File: signed-approval${jobID}.pdf`)
                })
            });
        })
    })
}

module.exports = approvalSigned

Connection is called right when the server boots

async startServer() {
    this.events.connection(this)
    if(this.c.secure) {
        let privateKey = fs.readFileSync("key.pem");
        let certificate = fs.readFileSync("cert.pem");
        https.createServer({
            key: privateKey,
            cert: certificate
        }, this.app).listen(this.c.securePort);
        this.log.success(`Secure server listening on port ${this.c.securePort}`)
    } else {
        this.app.listen(this.c.port, () => {
            this.log.success(`Server listening on port ${this.c.port}`)
        })
    }
  }

and the signature is called whenever we get a signature.

const formidable = require("formidable")
const HelloParser = require(`${__dirname}/../../util/HelloParser.js`)
async function signature(req, res) {
    // Send Hellosign response
    res.statusCode = 200
    res.setHeader("Content-Type", "text/text")
    res.send("Hello API Event Received") // Has to be exactly this or callback URL will get reset
    res.end()

    let form = new formidable.IncomingForm()
    form.parse(req, (err, fields, files) => {
        let helloEvent = JSON.parse(fields.json)
        let parser = new HelloParser(helloEvent.signature_request.message)
        if(helloEvent.event.event_type === "signature_request_sent") {
            // This event will be finished last, after ApprovalSigned is confirmed working & uploading
        } else if(helloEvent.event.event_type === "signature_request_all_signed") {
            let mJobID = parser.morawareJobID()
            let dl = helloEvent.signature_request.files_url
            this.events.approvalSigned(this, mJobID, dl) // Send this, the job ID needed for uploading, and the download link to the approvalSigned function
            this.log.success("Document Signed!")
        } else return this.log.verbose(helloEvent.event.event_type)
    })
}
module.exports = signature

Microsoft.CSharp assembly was not found

Hello - first of all thank you for maintaining this fork and keeping it updated for newer dotnet core and nodejs versions.

I'm able use edge-js successfully locally on a Mac to talk to a built dll file - but trying to get the same deployed on an Ubuntu 16.04 server is failing with this error:

Error: assembly specified in the dependencies manifest was not found -- package: 'Microsoft.CSharp', version: '4.4.1', path: 'lib/netstandard1.3/Microsoft.CSharp.dll'

dotnet core is installed on the VM by the root account and the npm install step also seem to be successful (once again by the root account) - here is the relevant log from npm install:

  > [email protected] install /var/app/staging/node_modules/edge-cs
  > node tools/install.js

  MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.
  Microsoft (R) Build Engine version 15.5.180.51428 for .NET Core
  Copyright (C) Microsoft Corporation. All rights reserved.

  MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.

  > [email protected] install /var/app/staging/node_modules/edge-js
  > node tools/install.js

  make: Entering directory '/var/app/staging/node_modules/edge-js/build'
    TOUCH Release/obj.target/edge_nativeclr.stamp
    CXX(target) Release/obj.target/edge_coreclr/src/common/v8synchronizationcontext.o
    CXX(target) Release/obj.target/edge_coreclr/src/common/callbackhelper.o
    CXX(target) Release/obj.target/edge_coreclr/src/common/edge.o
    CXX(target) Release/obj.target/edge_coreclr/src/CoreCLREmbedding/coreclrembedding.o
  ../src/CoreCLREmbedding/coreclrembedding.cpp: In static member function ‘static HRESULT CoreClrEmbedding::Initialize(BOOL)’:
  ../src/CoreCLREmbedding/coreclrembedding.cpp:581:7: warning: variable ‘foundEdgeJs’ set but not used [-Wunused-but-set-variable]
    bool foundEdgeJs = false;
         ^
  At global scope:
  cc1plus: warning: unrecognized command line option ‘-Wno-unused-private-field’
  cc1plus: warning: unrecognized command line option ‘-Wno-redundant-move’
  cc1plus: warning: unrecognized command line option ‘-Wno-mismatched-tags’
    CXX(target) Release/obj.target/edge_coreclr/src/CoreCLREmbedding/coreclrfunc.o
    CXX(target) Release/obj.target/edge_coreclr/src/CoreCLREmbedding/coreclrnodejsfunc.o
    CXX(target) Release/obj.target/edge_coreclr/src/CoreCLREmbedding/coreclrfuncinvokecontext.o
    CXX(target) Release/obj.target/edge_coreclr/src/CoreCLREmbedding/coreclrnodejsfuncinvokecontext.o
    CXX(target) Release/obj.target/edge_coreclr/src/common/utils.o
    CXX(target) Release/obj.target/edge_coreclr/src/CoreCLREmbedding/pal/pal_utils.o
    CXX(target) Release/obj.target/edge_coreclr/src/CoreCLREmbedding/pal/trace.o
    CXX(target) Release/obj.target/edge_coreclr/src/CoreCLREmbedding/fxr/fx_ver.o
    CXX(target) Release/obj.target/edge_coreclr/src/CoreCLREmbedding/fxr/fx_muxer.o
    CXX(target) Release/obj.target/edge_coreclr/src/CoreCLREmbedding/json/casablanca/src/json/json.o
    CXX(target) Release/obj.target/edge_coreclr/src/CoreCLREmbedding/json/casablanca/src/json/json_parsing.o
    CXX(target) Release/obj.target/edge_coreclr/src/CoreCLREmbedding/json/casablanca/src/json/json_serialization.o
    CXX(target) Release/obj.target/edge_coreclr/src/CoreCLREmbedding/json/casablanca/src/utilities/asyncrt_utils.o
    CXX(target) Release/obj.target/edge_coreclr/src/CoreCLREmbedding/deps/deps_format.o
    CXX(target) Release/obj.target/edge_coreclr/src/CoreCLREmbedding/deps/deps_entry.o
    CXX(target) Release/obj.target/edge_coreclr/src/CoreCLREmbedding/deps/deps_resolver.o
    CXX(target) Release/obj.target/edge_coreclr/src/CoreCLREmbedding/host/args.o
    CXX(target) Release/obj.target/edge_coreclr/src/CoreCLREmbedding/host/coreclr.o
    CXX(target) Release/obj.target/edge_coreclr/src/CoreCLREmbedding/host/libhost.o
    CXX(target) Release/obj.target/edge_coreclr/src/CoreCLREmbedding/host/runtime_config.o
    CXX(target) Release/obj.target/edge_coreclr/src/CoreCLREmbedding/pal/pal.unix.o
    SOLINK_MODULE(target) Release/obj.target/edge_coreclr.node
    COPY Release/edge_coreclr.node
    ACTION binding_gyp_build_managed_target_restore_bootstrap_packages lib/bootstrap/project.lock.json
    Restoring packages for /var/app/staging/node_modules/edge-js/lib/bootstrap/bootstrap.csproj...
    Generating MSBuild file /var/app/staging/node_modules/edge-js/lib/bootstrap/obj/bootstrap.csproj.nuget.g.props.
    Generating MSBuild file /var/app/staging/node_modules/edge-js/lib/bootstrap/obj/bootstrap.csproj.nuget.g.targets.
    Restore completed in 2.07 sec for /var/app/staging/node_modules/edge-js/lib/bootstrap/bootstrap.csproj.
    Restoring packages for /var/app/staging/node_modules/edge-js/src/double/Edge.js.CSharp/Edge.js.CSharp.csproj...
    Generating MSBuild file /var/app/staging/node_modules/edge-js/src/double/Edge.js.CSharp/obj/Edge.js.CSharp.csproj.nuget.g.props.
    Generating MSBuild file /var/app/staging/node_modules/edge-js/src/double/Edge.js.CSharp/obj/Edge.js.CSharp.csproj.nuget.g.targets.
    Restore completed in 227.5 ms for /var/app/staging/node_modules/edge-js/src/double/Edge.js.CSharp/Edge.js.CSharp.csproj.
    Restoring packages for /var/app/staging/node_modules/edge-js/src/double/Edge.js/Edge.js.csproj...
    Generating MSBuild file /var/app/staging/node_modules/edge-js/src/double/Edge.js/obj/Edge.js.csproj.nuget.g.props.
    Generating MSBuild file /var/app/staging/node_modules/edge-js/src/double/Edge.js/obj/Edge.js.csproj.nuget.g.targets.
    Restore completed in 164.74 ms for /var/app/staging/node_modules/edge-js/src/double/Edge.js/Edge.js.csproj.
    ACTION binding_gyp_build_managed_target_compile_bootstrap lib/bootstrap/bin/Release/netcoreapp1.1/bootstrap.dll
  Microsoft (R) Build Engine version 15.5.180.51428 for .NET Core
  Copyright (C) Microsoft Corporation. All rights reserved.

    Restore completed in 22.32 ms for /var/app/staging/node_modules/edge-js/lib/bootstrap/bootstrap.csproj.
    Restore completed in 4.38 ms for /var/app/staging/node_modules/edge-js/src/double/Edge.js.CSharp/Edge.js.CSharp.csproj.
    Restore completed in 8.16 ms for /var/app/staging/node_modules/edge-js/src/double/Edge.js/Edge.js.csproj.
    Edge.js -> /var/app/staging/node_modules/edge-js/src/double/Edge.js/bin/Release/netcoreapp1.1/EdgeJs.dll
    Edge.js.CSharp -> /var/app/staging/node_modules/edge-js/src/double/Edge.js.CSharp/bin/Release/netcoreapp1.1/Edge.js.CSharp.dll
    bootstrap -> /var/app/staging/node_modules/edge-js/lib/bootstrap/bin/Release/netcoreapp1.1/bootstrap.dll

  Build succeeded.
      0 Warning(s)
      0 Error(s)

  Time Elapsed 00:00:08.86
    TOUCH Release/obj.target/build_managed.stamp
  make: Leaving directory '/var/app/staging/node_modules/edge-js/build'

By setting EDGE_DEBUG=1 and comparing it with the successful run on the Mac, I see that the Ubuntu server does not have the global nuget packages directory on the ~/.nuget folder for the user that is running the node.js app (it is present at /root/.nuget with no permissions for the user account that runs the web server.

Here is the relevant log from Mac (successful) and Ubuntu (failing):

Mac

Library runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.1 does not exist
Reconciling library runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.1
Library runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.1 does not exist
Reconciling library runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.1
Library runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.1 does not exist
Reconciling library runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.1
Library runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.1 does not exist
Reconciling library runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.1
Library runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.1 does not exist
-- Listing probe configurations...
probe_config_t: probe=[/Users/me/.nuget/packages] match-hash=[1] patch-roll-forward=[0] prerelease-roll-forward=[0] deps-json=[$
probe_config_t: probe=[/usr/local/share/dotnet/shared/Microsoft.NETCore.App/2.0.5] match-hash=[0] patch-roll-forward=[0] prerelea$
Adding tpa entry: /Users/me/Source/Work/ARMATURE/product/armature.pdfgenerator/node_modules/edge-js/lib/bootstrap/bin/Release/n$
Processing TPA for deps entry [Microsoft.CSharp, 4.4.1, lib/netstandard1.3/Microsoft.CSharp.dll]
  Considering entry [Microsoft.CSharp/4.4.1/lib/netstandard1.3/Microsoft.CSharp.dll] and probe dir [/Users/me/.nuget/packages]
    Relative path query exists /Users/me/.nuget/packages/Microsoft.CSharp/4.4.1/lib/netstandard1.3/Microsoft.CSharp.dll
    Matched hash for [/Users/me/.nuget/packages/Microsoft.CSharp/4.4.1/lib/netstandard1.3/Microsoft.CSharp.dll]

Ubuntu

Library runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.1 does not exist
Reconciling library runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.1
Library runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.1 does not exist
Reconciling library runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.1
Library runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.1 does not exist
Reconciling library runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.1
Library runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.1 does not exist
Reconciling library runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.1
Library runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.1 does not exist
-- Listing probe configurations...
probe_config_t: probe=[/usr/share/dotnet/shared/Microsoft.NETCore.App/2.0.5] match-hash=[0] patch-roll-forward=[0] prerelease-roll-forward=[0] deps-json=[0x26a7bb0]
Adding tpa entry: /var/app/current/node_modules/edge-js/lib/bootstrap/bin/Release/netcoreapp1.1/bootstrap.dll
Processing TPA for deps entry [Microsoft.CSharp, 4.4.1, lib/netstandard1.3/Microsoft.CSharp.dll]
  Considering entry [Microsoft.CSharp/4.4.1/lib/netstandard1.3/Microsoft.CSharp.dll] and probe dir [/usr/share/dotnet/shared/Microsoft.NETCore.App/2.0.5]
    Skipping... probe in deps json failed
    Local path query did not exist /var/app/current/node_modules/edge-js/lib/bootstrap/bin/Release/netcoreapp1.1/Microsoft.CSharp.dll
Error: assembly specified in the dependencies manifest was not found -- package: 'Microsoft.CSharp', version: '4.4.1', path: 'lib/netstandard1.3/Microsoft.CSharp.dll'
Error occurred during CoreCLR initialization

[Help] Cannot run the sample

node .\101_hello_lambda.js

internal/modules/cjs/loader.js:731
return process.dlopen(module, path.toNamespacedPath(filename));
^

Error: The specified module could not be found.


Success: platform check for edge.js: node.js x64 v10.3.0

I have this error when npm install and node run the sample. Anyone know why?

Dotnet executable path in standalone mode

I can see following logic in the creclrembedding.cpp line 337.

if (mode == host_mode_t::standalone && dotnetExecutablePath.empty())
	{
		throwV8Exception("This is not a published, standalone application and we are unable to locate the .NET Core SDK.  Please make sure that it is installed; see http://microsoft.com/net/core for more details.");
	}

I don't understand why it looks for dotnet executable binary in the PATH if this is standalone mode. I think it should not be dependent on any external 'dotnet' binary but only the binaries in the EDGE_APP_ROOT. Can someone please explain the correct way to run in standalone mode?

how to call comeObject with edge

//this true?
Activator.CreateInstance(Type.GetTypeFromProgID("UnityObjects.UnityApplication"));

// UnityObjects.UnityApplication this is come object
//my old system in win32ole
win32ole.client.Dispatch('UnityObjects.UnityApplication');
if wrong i need to right code
thanks all

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.