kexplo / electron-edge

Run .NET and Node.js code in-process on Electron
http://tjanczuk.github.io/edge
Other
427 stars 36 forks source link

Support for .NET Core 2.0 #48

Open the-owl opened 7 years ago

the-owl commented 7 years ago

Is .NET Core 2.0 supported under Linux? I tried a hello world example, but it gave me a CoreCLR initialization error.

index.js looks like this:

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

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

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

Trying to run it produces the following output:

$ node_modules/.bin/electron index.js 
CoreClrEmbedding::Initialize - Failed to initialize CoreCLR, HRESULT: 0x80070057
App threw an error during load
TypeError: edge.initializeClrFunc is not a function
    at Object.exports.func (/home/theowl/projects/work/dotnet/testapp/node_modules/electron-edge/lib/edge.js:169:17)
    at Object.<anonymous> (/home/theowl/projects/work/dotnet/testapp/index.js:3:23)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at loadApplicationPackage (/home/theowl/projects/work/dotnet/testapp/node_modules/electron/dist/resources/default_app.asar/main.js:280:12)
    at Object.<anonymous> (/home/theowl/projects/work/dotnet/testapp/node_modules/electron/dist/resources/default_app.asar/main.js:322:5)
    at Module._compile (module.js:571:32)
/home/theowl/projects/work/dotnet/testapp/node_modules/electron/dist/resources/default_app.asar/main.js:6068: Uncaught TypeError: edge.initializeClrFunc is not a function

Electron: v1.5.0 Node.js: v7.4.0 .NET Core: v2.0.0 OS: Fedora 26

agracio commented 7 years ago

Electron-edge is based on Edge.js that does not support .NET Core versions above 1.0.0. I maintain a fork of edge called edge-js (https://github.com/agracio/edge-js) that offers support for .NET Core 2.0 although it might have issues. And just as electron-edge extends edge to support Electron platform there is electron-edge-js (https://github.com/agracio/electron-edge-js) to support Electron. It includes all features of edge-js and offers support for multiple Electron platforms. Try it out and let me know if it works for you.

Lestjer commented 6 years ago

hi @agracio

when I run my application with npm start, it runs without problem but after build it with electron-builder it shows: "edge.initilizeClrFunc is not a function at Object.exports.func .."

electron: v1.7.10 electron-edge-js: v8.3.0 node: v8.9.4 .NET Core: v2.1.4