Skip to content

React.NET is broken in Visual Studio 2017 RC and .NET Core 1.1 #372

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
olivierr91 opened this issue Feb 7, 2017 · 12 comments
Closed

React.NET is broken in Visual Studio 2017 RC and .NET Core 1.1 #372

olivierr91 opened this issue Feb 7, 2017 · 12 comments

Comments

@olivierr91
Copy link

olivierr91 commented Feb 7, 2017

As seen here:
https://reactjs.net/getting-started/aspnetcore.html
and here:
#361

React.NET is broken in Visual Studio 2017 and .NET Core 1.1. Navigating to a JSX file fails with a "React.TinyIoC.TinyIoCResolutionException: Unable to resolve type: React.IReactEnvironment" error message.

The issue has been reported by different users, yet we have not heard anything from the React.NET developpers for a while about it. Needless to say that this is a very serious problem and it should be top priority to fix because there is currently no acceptable workaround. May any developper officially acknowledge the issue? Is there an ETA for the fix?

Thank you very much

@DaveKP
Copy link
Contributor

DaveKP commented Feb 7, 2017

A while ago I wrote a diff that fixed React.NET in VS2017 for me, #354.

I believe it's still only available in the development version, and no-one has confirmed (or refuted!) for me yet that the fix is working for anyone other than myself.

Quoting @Daniel15

If you want to try the development version, you can use the NuGet package server on our AppVeyor build (https://ci.appveyor.com/nuget/reactjs.net/). Instructions are available at https://reactjs.net/getting-started/download.html#development-builds

If you have the option to try the dev build @orobert91, it's worth a shot, not least because I'd like to know if it actually works!

@Daniel15
Copy link
Member

Daniel15 commented Feb 7, 2017

Yeah, please try the dev version. Visual Studio 2017 is not RTM yet so I still haven't fully tested it. I might set up a VM and test it out.

@olivierr91
Copy link
Author

Excellent! I will try it and give you feedback

@olivierr91
Copy link
Author

I have tested the latest development build. Instead of React.TinyIoC.TinyIoCResolutionException I get the following exception:
The type initializer for 'VroomJs.JsEngine' threw an exception. ---> System.TypeInitializationException: The type initializer for 'VroomJs.JsEngine' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'VroomJsNative': The specified module could not be found. (Exception from HRESULT: 0x8007007E) at VroomJs.JsEngine.js_set_object_marshal_type(JsObjectMarshalType objectMarshalType) at VroomJs.JsEngine..cctor() --- End of inner exception stack trace --- at VroomJs.JsEngine..ctor(Int32 maxYoungSpace, Int32 maxOldSpace) at React.VroomJsEngine.<>c.<.cctor>b__23_0() at System.Lazy1.CreateValue()
at System.Lazy1.LazyInitValue() at React.VroomJsEngine..ctor() --- End of inner exception stack trace --- at React.VroomJsEngine..ctor() at React.VroomJsEngine.Factory.CreateEngine() at React.JavaScriptEngineFactory.GetFactory(JsEngineSwitcher jsEngineSwitcher, Boolean allowMsie)

@olivierr91
Copy link
Author

olivierr91 commented Feb 10, 2017

I solved the issue by installing the JavaScriptEngineSwitcher.ChakraCore and JavaScriptEngineSwitcher.ChakraCore.Native.<your_OS> NuGet packages and manually specifying the JS engine.

Added:
engineSwitcher.DefaultEngineName = ChakraCoreJsEngine.EngineName; engineSwitcher.EngineFactories.AddChakraCore();
Before
app.UseReact(config => { });

Now I got a fully working ReactJS.NET under Visual Studio 2017 RC.

@Daniel15
Copy link
Member

VroomJs is only really for Mono (Linux and Mac OS X), it's better to use ClearScript V8 on Windows.

@olivierr91
Copy link
Author

olivierr91 commented Feb 10, 2017

V8 is not compatible with .NET Core.
Jurassic is not compatible with .NET Core.
Jint is slow
Unless I am mistaken, the only decent option left is ChakraCore

@wilka
Copy link

wilka commented Feb 11, 2017

Using the dev branch of ReactJS.NET with ChakraCore is the only way I've managed to get server-side rendering working in ASP .NET Core as well.

@Daniel15
Copy link
Member

Daniel15 commented Feb 13, 2017

I installed VS2017 RC today to test this out, but I can't even get a basic project working out-of-the-box. I created a new .NET Core 1.0 site, and when I run it using IIS Express I just get the "Chrome script debugging in Visual Studio is enabled" page followed by a blank page 😕

@Daniel15
Copy link
Member

Also I can't open the ReactJS.NET project with VS2017 RC as I get these errors when it tries to convert the xproj files:

React.AspNet\React.AspNet.xproj: Could not read post-migration report at 'C:\Users\Daniel\AppData\Local\Temp\d5jrt05h.tva'.

React.AspNet\React.AspNet.xproj: Failed to migrate XProj project React.AspNet. 'dotnet migrate --skip-backup -s -x "C:\src\React.NET\src\React.AspNet\React.AspNet.xproj" "C:\src\React.NET\src\React.AspNet" -r "C:\Users\Daniel\AppData\Local\Temp\d5jrt05h.tva" --format-report-file-json' exited with error code 1.

React.AspNet\React.AspNet.xproj: No executable found matching command "dotnet-migrate"

@olivierr91
Copy link
Author

olivierr91 commented Feb 13, 2017

.NET Core 1.0 is fairly new technology. Try updating your .NET Core packages to 1.1 using NuGet and update the SDK using https://www.microsoft.com/net/download/core#/current -> Current

@Daniel15
Copy link
Member

I pushed out #354 as ReactJS.NET 3.0.1, which seems to fix this. After messing with VS2017 so it worked properly, I managed to create a new .NET Core 1.1 site and a local build of ReactJS.NET worked out-of-the-box after following the installation instructions at https://reactjs.net/getting-started/aspnetcore.html. Looks like it uses ChakraCore on .NET Core, which is fine.

Let me know if you still encounter issues!

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

4 participants