Skip to content

AccessViolationException in JavaScriptEngineSwitcher.ChakraCore 2.4.3 #30

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

Closed
defcon84 opened this issue May 30, 2017 · 9 comments
Closed

Comments

@defcon84
Copy link

When i upgrade ChakraCore (incl. native windows packages) to 2.4.3 in my project, the AccessViolationException is back.
Downgrade to 2.4.2 and everything works perfectly.
It seems something has changed in this version, or do i miss something on my server? (like a specific windows update?)

Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
   at JavaScriptEngineSwitcher.ChakraCore.JsRt.NativeMethods.JsSetCurrentContext(JavaScriptEngineSwitcher.ChakraCore.JsRt.JsContext)
   at JavaScriptEngineSwitcher.ChakraCore.ChakraCoreJsEngine+<>c__DisplayClass22_0`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].<InvokeScript>b__0()
   at JavaScriptEngineSwitcher.ChakraCore.ScriptDispatcher+<>c__DisplayClass12_0`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].<Invoke>b__0()
   at JavaScriptEngineSwitcher.ChakraCore.ScriptDispatcher.StartThread()
   at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.ThreadHelper.ThreadStart()

project packages:

  • React.AspNet 3.0.1
  • JavaScriptEngineSwitcher.ChakraCore 2.4.3
  • JavaScriptEngineSwitcher.ChakraCore.Native.win-x64 2.4.3
  • JavaScriptEngineSwitcher.ChakraCore.Native.win-x86 2.4.3
@Taritsyn
Copy link
Owner

Hello, Filip!

It seems something has changed in this version, or do i miss something on my server? (like a specific windows update?)

ChakraCore was updated: 1.4.4 -> 1.5.0.

It is possible, that new version of the ChakraCore conflicts with the Chakra from browser (Internet Explorer and Edge).

Try to disable usage of the JavaScriptEngineSwitcher.Msie by using the AllowMsieEngine property, or configure explicit usage of the JavaScriptEngineSwitcher.ChakraCore.

@defcon84
Copy link
Author

Forgot to tell you, i already disable MSIE this way:

JsEngineSwitcher.Instance.EngineFactories.Remove(JavaScriptEngineSwitcher.Msie.MsieJsEngine.EngineName);
JsEngineSwitcher.Instance.EngineFactories.AddChakraCore();

@Taritsyn
Copy link
Owner

If you did this after registering the React.NET, then these settings will not have any effect. You just need to insert the following code before registering the React.NET:

JsEngineSwitcher.Instance.EngineFactories.AddChakraCore();

And you do not need to remove anything.

Which ASP.NET framework do you use?

@defcon84
Copy link
Author

Offcourse, this is the order i do it:

JsEngineSwitcher.Instance.EngineFactories.AddChakraCore();

services.AddCors(options => .....

services.AddMvc();
services.AddReact();

I use an ASP.NET MVC Core project with the ASP.NET 4.6.2 framework.
Runs on Windows Server 2012 R2 with IE 11.0.9600.18666 (update 11.0.42)

@Taritsyn
Copy link
Owner

Then, in your case, it's better to use the following code (read details in the “Registration of JS engines -> ASP.NET Core 1.X” section of documentation):

services.AddJsEngineSwitcher()
	.AddChakraCore()
	;

Of course, this will not prevent error, but it would be more correct.

@defcon84
Copy link
Author

I replaced the old AddChakraCore(); with the new one. And indeed as expected, it did not fix our problem. Only thing I can do now is try and update Windows. I'll try this soon, when the acceptance server isn't used.

@Taritsyn
Copy link
Owner

During half an hour I will publish the fix.

@Taritsyn
Copy link
Owner

Try upgrading to version 2.4.4. Packages with native assemblies has not changed.

@defcon84
Copy link
Author

It seems to be fixed!
Thank you very much!

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

2 participants