Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistently reproducible C++ Runtime error on reloading Electron window: g_coreclr == nullptr #16

Closed
tjcouch-sil opened this issue Jan 18, 2023 · 3 comments

Comments

@tjcouch-sil
Copy link

tjcouch-sil commented Jan 18, 2023

Hello!

It seems I am having a consistent assertion failure on reloading the electron app with this quick start repo.

Steps to reproduce:

  1. Clone the repo git clone https://github.com/agracio/electron-edge-js-quick-start.git
  2. Install NPM dependencies npm install
  3. Build .NET project dotnet build src/QuickStart.sln
  4. Run the electron app npm start
  5. Notice that the calls to C# function perfectly!
  6. Reload with Ctrl+R or View->Reload
  7. Microsoft Visual C++ Runtime Library window pops up with "Assertion failed! coreclr.cpp Line 49 Expression: g_coreclr == nullptr" as pictured:
    image
  8. To see what happens, click Ignore
  9. Notice that there are no results in the window anymore as pictured:
    image

I am running in Windows. I have VS2022 installed. I wonder if this affects anything. I also experience this issue after upgrading to .NET 6 and 7 in ExternalLibrary and QuickStart.Core.

Do you have any ideas or suggestions for me to try? Or if I should move this to the edge-js repo or the electron-edge-js repo, let me know. Thank you very much for your time!

Thank you also for your hard work on electron-edge-js. It is quite a unique and powerful solution to bridging Node and .NET.

Update: I installed VS2017 and tried again. When building, I receive an error that says, "The current .NET SDK does not support targeting .NET Core 3.1. Either target .NET Core 1.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.1." I tried enabling previews of the .NET Core SDK, but that did not remove the error. It seems it may be a limitation of VS2017 because it does not use MSBuild 16. I also tried changing the .NET Core version to 1.1, fixing the AppDomain error, building (successfully!), and running the electron app. I got the same blank tables as in my second screenshot above. Reloading the page yielded the same runtime error as discussed above. I imagine this error is not related to the VS version or the .NET version but to edge-js or some aspect of this quick-start project. Let me know what you think. Thank you!

@agracio
Copy link
Owner

agracio commented Sep 18, 2024

Duplicate of agracio/electron-edge-js#89, currently there is no solution for this problem when electron-edge-js is used on main Electron thread. The only way to mitigate it is to create Electron app using Electron IPC.
'quick-start' is already updated and no longer has that issue.

@agracio agracio closed this as completed Sep 18, 2024
@hellozyemlya
Copy link

@agracio "main thread" is a thread where browser javascript executed, e.g. render process?

@agracio
Copy link
Owner

agracio commented Oct 22, 2024

Yes, updated quick-start uses Electron IPC model to mitigate the problem.

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

No branches or pull requests

3 participants