Skip to content

Exception when upgrading to latest React.NET version #484

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
meisterpeeps opened this issue Nov 28, 2017 · 5 comments
Closed

Exception when upgrading to latest React.NET version #484

meisterpeeps opened this issue Nov 28, 2017 · 5 comments

Comments

@meisterpeeps
Copy link

I tried updating to 3.2 and I am now getting a React.Exceptions.ReactNotInitialisedException: 'ReactJS.NET has not been initialised correctly.'

That includes three exceptions:
-TinyIoCResolutionException: Unable to resolve type: React.ReactEnvironment
-TinyIoCResolutionException: Unable to resolve type: React.JavaScriptEngineFactory
-ReactNotInitialisedException: React has not been loaded correctly. Please expose your version of React as global variables named 'React', 'ReactDOM' and 'ReactDOMServer', or enable the 'LoadReact' configuration option to use the built-in version of React.

Other than upgrading the nuget packages associated with React.NET and moving to React 16.0.0 from 15.4.1, I have changed nothing else. Before the update all was well.
Any thoughts? :/ Thanks for any help.

@dustinsoftware
Copy link
Member

A few things to check:

  • Does the error occur if you update to React 16 without updating React.NET? It works, but will throw a warning at runtime saying the server-render call is deprecated.
  • Try disabling server-render and see if your component renders on the page. You can do so by passing clientOnly: true as an argument to the render call in your razor file

@Daniel15
Copy link
Member

It sounds like you're calling .SetLoadReact(false) but aren't properly loading React yourself. Try instead using ReactJS.NET's built-in React version (by removing the .SetLoadReact(false) call).

@meisterpeeps
Copy link
Author

Just want to mention that I wasn't able to get 3.2 working, but I was able to get 3.1 working--as I was updating from 3.0. As for your two suggestions; I tried the clientOnly: true, and the problem didnt go away; and as far I know I have been loading React myself correctly, as it worked on 3.0 and works on 3.1.
Anyway, thanks for the quick feedback. If I try again to go for 3.2, and if I get any new error information, or it just happens to work, Ill let you know.

@Daniel15
Copy link
Member

Just want to mention that I wasn't able to get 3.2 working, but I was able to get 3.1 working-

3.2 upgraded to React 16 (#445) so you might be hitting some incompatibilities with your code in React 16. 3.0 and 3.1 used React 15.3.2.

@dustinsoftware
Copy link
Member

Hi there, I'm closing this issue due to inactivity. Please let us know if you'd like some more help.

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