agracio / edge-js

Run .NET and Node.js code in-process on Windows, macOS, and Linux
MIT License
643 stars 95 forks source link

Nuget package 11.15.0: Could not load file or assembly 'EdgeJs, Version=9.3.0.0 #130

Closed smilovich closed 7 months ago

smilovich commented 3 years ago

The latest version of EdgeJS 11.15.0 from nuget doesn't work. It just shows error while building: System.BadImageFormatException: 'Could not load file or assembly 'EdgeJs, Version=9.3.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.' Tested with .Net Framework 4.7.2, 4.8, 5.0

Previous nuget package EdgeJS 9.3.4 works well with the same code from examples.

Also it would be great to be able download EdgeJS release with at latest stable NodeJS 10.xx version for .net 5.0 framework. I tried to do create own build, created node.dll 10.24.0, built EdgeJS C# project, but in a result when I invoke Edge.Func it just throw the following error:

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

Error: The specified procedure could not be found.
\\?\C:\\EdgeNet\bin\Debug\edge\x64\edge_nativeclr.node
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:807:18)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (C:\EdgeNet\bin\Debug\edge\edge.js:53:8)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)

JFY NodeJS 12.xx and 14.xx still have issues with creating node.dll shared library https://github.com/nodejs/node/issues/36516

fortnum commented 3 years ago

I have the same problem, but the exception is at runtime. While building I got just MSB3270 warning: "There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "EdgeJs, Version=9.3.0.0, Culture=neutral, processorArchitecture=AMD64", "AMD64".

After changing project's Platform Target from Any CPU to x64 the exception gone, but now at first I have a message box with: "The procedure entry point ?DisposeGlobal@V8@v8@@CAXPEAPEAVObject@internal@2@@Z could not be located in the dynamic link library \?\D:\\bin\Debug\edge\x64\edge_nativeclr.node.

Other time I have in VS's output window an error: "internal/modules/cjs/loader.js:857 return process.dlopen(module, path.toNamespacedPath(filename)); Error: The specified procedure could not be found.".

\\?\D:\<my-project-path>\bin\Debug\edge\x64\edge_nativeclr.node
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:857:18)
    at Module.load (internal/modules/cjs/loader.js:685:32)
    at Function.Module._load (internal/modules/cjs/loader.js:620:12)
    at Module.require (internal/modules/cjs/loader.js:723:19)
    at require (internal/modules/cjs/helpers.js:14:16)
    at Object.<anonymous> (D:\<my-project-path>\bin\Debug\edge\edge.js:53:8)
    at Module._compile (internal/modules/cjs/loader.js:816:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
    at Module.load (internal/modules/cjs/loader.js:685:32)
    at Function.Module._load (internal/modules/cjs/loader.js:620:12)
The program '[15756] my-project.exe' has exited with code 1 (0x1).
sg2707 commented 3 years ago

Any solution for this issue? @fortnum @smilovich @agracio

longdang2709 commented 2 years ago

Any update? I got this issue with the latest NuGet package v11.15.0. Any NodeJs newer than v8.9.3 are getting this issue?