-
Notifications
You must be signed in to change notification settings - Fork 926
JSX on-the-fly compilation results in AccessViolationException on ASP.NET 5 MVC 6 #281
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
Comments
I'm running into similar problems at the moment. I'm trying to go through the ReactJS.NET tutorial at the moment. My environment is VS 2015 Community (14.0.25123.00 Update 2), I'm running on ASP.NET Core RC2 (1.0.0-preview1-002702) and ReactJS.NET 2.4.0. I'm using the full .NET CLR ("net461") as I gather ReactJS is not currently compatible with the Core CLR. I've seen this issue and I've also seen this issue. Working my way through the tutorial, there are some obvious differences that can be easily worked around (e.g. change
Yesterday, it seemed like it had something to do with which web server setup I use to debug my project. I was consistently getting the System.AccessViolationException when running my project through IIS Express (which I gather reverse proxies over to Kestrel thought I'm not 100% convinced this documentation is up to date), but not when running via Kestrel directly. Then the problem seemed to flip and was only happening when I ran the project through kestrel directly and worked fine when I used IIS Express. Now I can't seem to reproduce it consistently at all unless I move onto the "Optimization: Server-side rendering" section of the ReactJS.NET tutorial. After implementing the steps in this section (noting that I also note that the way bundling and minification is done in ASP.NET Core has substantially changed from the older ASP.NET method outlined in the ReactJS.NET tutorial, I'm not super familiar with Gulp and what's needed for Gulp to play nicely with JSX (I gather I'll need to hook Babel into the mix somehow), so I haven't been able to get it working as yet. But I do wonder, what will the role of ReactJS.NET be in relation to bundling/minification in the new ASP.NET Core world? Will it have any role? I know ASP.NET Core is moving quite quickly at the moment, I'm starting to think it might be better to slowly back away from using ReactJS.NET with ASP.NET Core until things stabilise a little and the various documentation can catch up. |
I've seen this error myself several times, but only when using the MSIE JS Engine. I reported it to the developer of the MSIE JS engine library here: Taritsyn/MsieJavaScriptEngine#7 As for getting ClearScript working, several people have done that with ASP.NET Core in the past, I haven't tried it myself recently though. Here's an example where @samppis got ASP.NET 5 + ReactJS.NET + ClearScript running on Azure: #198 along with his blog post at http://www.samulihaverinen.com/web-development/dotnet/2016/01/19/how-to-run-clearscript-v8-javascript-engine-in-azure/ and the documentation he wrote at http://reactjs.net/guides/azure.html That was around either Beta 8 or RC1 though. If I get some free time, I'll see if anything has changed with RC2 that would cause this to break. |
Thank you! |
I have the same setup as @gaelian (same IDE version, same NuGet package versions, same ASP.NET Core RC2 on full-clr, etc.). I am having the same issue, though I am running on Kestrel. My startup.cs has this:
I can make the error disappear if I comment the Every time I put the |
Hey thanks @brentarias, that's a good lead. Maybe something in the JavaScript engine initialisation is causing the error... Perhaps a race condition or something. |
Seeing this issue with React.MSBuild consistently as well. I have an application with only a handful of jsx files, but I noticed a definite uptick in the occurrence of the exception as I added more jsx files. Hopefully this tidbit helps. Edit: Running .Net 4.5.2, Win 7, building a Sharepoint Add-in, so MVC & CoreCLR are not involved.
|
I've seen it mentioned multiple times that you can switch the JsEngine to V8, which seems to be a bit more stable. I've tried editing the app.config to remove the MsieJsEngine, but I'm still seeing the same error, which leads me to believe that maybe the JsEngine is hard coded for React.MSBuild? If not, could you help me figure out how to switch so I can move forward with this? |
Folks sorry if this is offtopic. You keep referring to javascript engine in your replies
I can not seem to find a document explaining how to pick the js engine used by React.Net Is there a work around? |
You can disable the MSIE engine by calling |
Is there any information / progress on this? We are rendering everything in clientOnly modus because of this exception. |
I was able to able to resolve or work around by doing this .SetAllowMsieEngine(false) plus copying ClearScriptV8-32.dll, ClearScriptV8-64.dll, v8-ia32.dll, v8-x64.dll into project root folder. }, |
I tried that and got the following:
|
The answer provided by @anatolitrifonov worked for me, it seems that the JavaScriptEngineSwitcher.V8.props is not correctly processed so the V8 dlls are not registered as dependencies. |
@Daniel15 could you test this: turn of anti-virus and run again |
For anyone encountering this error, could you please try upgrading the Thanks! |
I think you mean 1.7.2? This version did not fix the issue for me. |
1.7.2 did not fix the issue for me neither. |
Oops, sorry, I meant MsieJavaScriptEngine 1.7.2. I'll probably just drop MSIE support soon, or change it to only use the new open-source release of Chakra. I had another look at ClearScript, and the only reliable way I could find to copy over the ClearScript DLLs in an ASP.NET Core project without checking them into the project repo was to have an ugly
This is super-ugly since it has the local NuGet package path hard-coded, but it seems to work fine. Alternatively, just copy them to your project's root directory then use Doing something like that and also adding |
Sorry I took so long to get around to this issue! I've been pretty busy 😞 I just wrote a blog post summarising this issue: http://reactjs.net/2016/08/protected-memory-exceptions-and-dotnet-core.html. Basically, switching to V8 appears to fix the issue in every case I've seen. It's bit tricky for ASP.NET Core projects as you need to update them to properly copy over the I'm going to close out this issue due to the fact that I haven't seen it occur at all once switched to V8 instead of MSIE. Please feel free to reopen it if you still see this exception even after switching to V8. For instructions on how to use V8, refer to the site at http://reactjs.net/2016/08/protected-memory-exceptions-and-dotnet-core.html. |
We are still having issues with V8. |
@mwethington - Could you please provide a stack trace? So far I've only seen this error with the MSIE JS engine in the stack trace. |
Carl – please provide a stack that we can share with Daniel From: Daniel Lo Nigro [email protected] @mwethingtonhttps://github.com/mwethington - Could you please provide a stack trace? So far I've only seen this error with the MSIE JS engine in the stack trace. — |
had myself depending on the computer i used for my project ( using React.MSBuild 3.0) the Unhandled Exception: System.AccessViolationException ... i had to disable and than re-enable the windowbase reference on my project |
any solution for it? i also meet the problem |
Same problem here |
@orobert91 It seems to me, that this issue is no longer relevant, because all the major problems associated with the JavaScriptEngineSwitcher.Msie and JavaScriptEngineSwitcher.ChakraCore were solved in version 2.2.0. |
@orobert91 - Did you try upgrading to the very latest JavaScriptEngineSwitcher? |
Yes, I am not sure this is the exact thing that solved the issue (because I tried a lot of stuff) but I did not run into the error message since then... |
#281 I am not pretty sure if this is the best place to mention it but this issue is still happening, at least for MVC version. I am using The stack trace is the same:
Any idea? |
@Jamo10 To begin, I recommend you upgrade to latest stable version of the JavaScript Engine Switcher (version 2.4.10). Then you must explicitly register a JS engines and set default engine (in your case If after all these actions an error occurs, send me an error message with the full stack trace. |
Uh oh!
There was an error while loading. Please reload this page.
I get the following exception whenever I try to load a
.jsx
file:I followed the guide on Getting Started on ASP.NET 5 on a new MVC 6 project.
The really strange thing is that I don't know how I can make the error disappear, but when I do, it won't reappear until I clean the project. Sometimes it's hard to get rid of, other times it's gone after a few tries.
I have even seen it start working without the script being added to the configuration. Right now my config has:
I know this issue is probably related to #28, but either something is missing from the guide, or something should be fixed.
Update 1:
After looking round further, it seems that
MsieJavaScriptEngine.dll
is the culprit. I updated my config with.SetAllowMsieEngine(false)
, and installed JavaScriptEngineSwitcher.V8. Still, I get that the directorybin\Debug\net461\win7-x64\ClearScript.V8
is missing. When I look inbin\Debug\net461\win7-x64\
I seeClearScript.dll
, so I don't get why it wants to look in that folder.Update 2:
I tried adding the folder
bin\Debug\net461\win7-x64\ClearScript.V8
, but of course this gives another error. How do I get V8 working?The text was updated successfully, but these errors were encountered: