electron-edge icon indicating copy to clipboard operation
electron-edge copied to clipboard

StackOverflowException during Edge compiling of c# using .Net Core

Open SeanSnyders opened this issue 8 years ago • 10 comments

Trying to use Electron, Edge, and .Net Core. I'm getting a StackOverflowException when trying to call a method in my own compiled .Net Core assembly.

I followed the suggested additions to the .Net Core project setup etc as described here and here as per Edge documentation.

On Windows 10, using versions:

image

I set up a test project here to illustrate the problem: https://github.com/SeanSnyders/TestExamples/tree/master/Test-Electron-Edge-DotNetCore

To build and run, follow general instructions as per the project readme.md: npm install npm run rebuild npm start

If I change this line image

to use bridge-inline.js it works fine, but using bridge-external.js and calling the TestMe method in the .NET Core compiled assembly gives me a StackOverflowException during the Edge JIT compiling of the c# code, as illustrated by the trace output when the environment variable COREHOST_TRACE=1 is set:

image

I've tried various things to fix this. Playing around with EDGE_APP_ROOT etc, but no solution just yet. Is there a problem with the environment, or can Edge not find my assembly? Would be odd giving a StackoverflowException though....

Help appreciated!

SeanSnyders avatar Feb 27 '17 02:02 SeanSnyders

Oh, in contrast, using VS2015 and .Net 4.6.1 it works fine to call c# methods in an external library as depicted in bridge-external.js.

SeanSnyders avatar Feb 27 '17 03:02 SeanSnyders

Ping? Anyone monitoring these issues?

SeanSnyders avatar Mar 13 '17 21:03 SeanSnyders

It seems that the problem might not be limited to .Net Core. I'm seeing the StackOverflowException on OSX as well using Mono 4.6: image

When setting the EDGE_USE_CORECLR=1 env variable, the error looks like this on OSX: image

So it seems there is definitely something going on in Edge and is not necessarily specific to .Net Core per se.

SeanSnyders avatar Apr 05 '17 03:04 SeanSnyders

After doing some digging around in a Debug compile of Edge, I can confirm that this is an Edge issue. See https://github.com/tjanczuk/edge/issues/526#issuecomment-292057983

@tjanczuk @kexplo Is it possible to move this issue to the Edge repo please?

SeanSnyders avatar Apr 06 '17 03:04 SeanSnyders

I have the same issue. I am receiving an error in the .NET code of an electron-edge call. Is there an available fix? I am on electron-edge 6.5.5, node 6.11.0 and electron 1.7.8.

vjpudelski avatar Apr 09 '18 15:04 vjpudelski

Try using electron-edge-js and let me know if you still experience the issue.

agracio avatar Apr 09 '18 15:04 agracio

I don't appear to get the StackOverflowException anymore but the application also doesn't return from the .NET dll if an exception is thrown from the dll. Shouldn't the exception be deserialized into the error object of the callback function?

vjpudelski avatar Apr 09 '18 15:04 vjpudelski

It should, do you know what exception you .NET code is throwing?

agracio avatar Apr 09 '18 15:04 agracio

you are correct it appears to be coming through now... Thanks...

What is the difference from electron-edge and electron-edge-js?

vjpudelski avatar Apr 09 '18 16:04 vjpudelski

https://github.com/agracio/electron-edge-js the differences are in the readme, the main difference is that its based on https://github.com/agracio/edge-js that has some major bug fixes compared to original Edge.js repo with StackOverflowException being one of them.

agracio avatar Apr 09 '18 17:04 agracio