Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Error: Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Invalid pointer (Exception from HRESULT: 0x80004003 (E_POINTER)) #27

Open
Umplify opened this issue Jan 26, 2017 · 4 comments

Comments

@Umplify
Copy link

Umplify commented Jan 26, 2017

I admit that this issue may sound a duplicate of issue tjanczuk#496, but I cannot overcome the problem. I guess either a point is missing in the documentation of edge / electron-edge or something is not clear to me.

I create a super simple C# library in .Net Core 1.1 with .Net Standard 1.6. I finished dotnet restore, dotnet build and dotnet release etc. .... per the documentation successfully. Things went on well and I moved all DLLs, json files, etc. from the publish folder to a folder called "dll" within the folder where node runs. So, it looks like this: C:\electron-quick-start\dll

var clrMethod = edge.func({
    assemblyFile: 'dll\\MyLibrary.dll',
    typeName: 'MyLibrary.Startup',
    methodName: 'Invoke'
});

clrMethod('This text comes from JavaScript!', function (error, result) {
    if (error) throw error;
    console.log(result);
});

When I run the js file, I receive the error message mentioned in the subject line. Then I set the following environment variables:

EDGE_USE_CORECLR=1
EDGE_APP_ROOT = C:\electron-quick-start\dll

But I received this error message / exception:

TypeError: edge.initializeClrFunc is not a function

Even I tried to put all contents of "dll" folder side by side where node is running and that resulted into no success. Also, I set app root to the exact publish folder generated by dotnet release and that was not conclusive either.

What is missing in this exercise or may have been done wrong?!

As a side note: I am using the recent version of electron-edge.

@mhgamework
Copy link

I also have this problem, did anyone find a solution?

@fgodoy
Copy link

fgodoy commented Apr 12, 2017

Same problem. The problem still happening in most simple in line app. Anyone can help, please?

@mhgamework
Copy link

I gave up trying to use electron-edge as having these kind of problems already when starting out is a big forebode for problems to come when it is actually being used.
Combined with the fact that electron-edge does not really a have a proper way to communicate between node and C# on a architectural level, I would suggest to reconsider using electron-edge. You need to manually make almost untyped electron-edge specific wrappers for all you communication.

If we have to write the communication interface ourselves, we might aswel use something like websockets or plain tcp/ip to do the communication. I do not know what the exact performance difference will be but i am not even sure if electron-edge will be faster, because alot will depend on how you do the marshalling.

If you really, really need very high performance its probably better to just create a C++ binding for node, you can probably use C++/CLI bindings to directly communicate with C# managed code. This will give you the same benefits as electron-edge, but you dont need the additional dependency and you have control over what is happening.

@Syrus666
Copy link

Using coreclr rather than using a dll according to here: tjanczuk#463 we need to create a nuget package for our pre-compiled netcore code and add a deps.json at the app root referencing out package and edge.js. After following those instructions though I still get the

TypeError: edge.initializeClrFunc is not a function

But the missing System.Runtime is resolved.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants