React.NET
React.NET copied to clipboard
Unable to resolve type: React.IReactEnvironment on certain PC
Please verify these steps before filing an issue, and check them off as you go
- [X] The relevant native JavascriptEngineSwitcher library packages are installed (such as
JavaScriptEngineSwitcher.V8.Native.win-x64
) - [X] The VC++ 2017 runtime is installed
- [X] The value of
SetUseReact
andSetUseBabel
is correct inReactConfig.cs
orStartup.cs
- [X] I've looked at the sample projects in this repo to verify that my app is configured correctly
I'm using these library versions:
-
ReactJS.NET
: 5.2.10 -
JavaScriptEngineSwitcher
: 3.5.5 -
react
andreact-dom
: 16.14.0 -
webpack
: (N/A if using bundled react) N/A - We are not using this, but not using the bundled version of react -
node
: (N/A if using bundled react) N/A - We are not using this, but not using the bundled version of react
Runtime environment:
- OS: Windows 10 x64
- .NET Framework or .NET Core Version: .Net Framework 4.8
Steps to reproduce
- Launch our web app.
- Navigate to a page that renders a Razor view that calls Html.React()
- Observe the following exception.
Unable to resolve type: React.IReactEnvironment
[TinyIoCResolutionException: Unable to resolve type: React.IReactEnvironment]
React.TinyIoC.TinyIoCContainer.ResolveInternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options) in D:\a\1\s\src\React.Core\TinyIoC\TinyIoC.cs:3825
React.TinyIoC.TinyIoCContainer.Resolve() in D:\a\1\s\src\React.Core\TinyIoC\TinyIoC.cs:1944
React.ReactEnvironment.get_GetCurrentOrThrow() in D:\a\1\s\src\React.Core\ReactEnvironment.cs:102
[ReactNotInitialisedException: ReactJS.NET has not been initialised correctly. Please ensure you have called services.AddReact() and app.UseReact() in your Startup.cs file.]
React.ReactEnvironment.get_GetCurrentOrThrow() in D:\a\1\s\src\React.Core\ReactEnvironment.cs:106
React.Web.Mvc.HtmlHelperExtensions.React(HtmlHelper htmlHelper, String componentName, T props, String htmlTag, String containerId, Boolean clientOnly, Boolean serverOnly, String containerClass, Action`3 exceptionHandler, IRenderFunctions renderFunctions) +517
ASP._Page_Areas_Administration_Views_LoginPageStatusMessages_Index_cshtml.Execute() in C:\Users\Zak (Work)\git\CompTracker.Web\src\CompTracker.Web\Areas\Administration\Views\LoginPageStatusMessages\Index.cshtml:31
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +252
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +148
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +107
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +384
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +97
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +829
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +829
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +81
System.Web.Mvc.Async.<>c__DisplayClass3_1.<BeginInvokeAction>b__1(IAsyncResult asyncResult) +188
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
System.Web.Mvc.<>c.<BeginExecuteCore>b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState) +35
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +73
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +39
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
System.Web.Mvc.<>c.<BeginProcessRequest>b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState) +49
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +73
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +657
System.Web.<>c__DisplayClass285_0.<ExecuteStepImpl>b__0() +46
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +155
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +140
We do not observe this issue on either our testing environment servers or another developer's PC. This leads me to thing something about my particular setup isn't correct. Most of the reading I've done where this error occurs seems to result from something being set up incorrectly in the code when configuring react, but since this issue is specific to my PC that seems unlikely.
Any input on this would be much appreciated.
Any chance we could get someone to look at this issue? It's been a few months, and it's a significant blocker in us being able to use ReactJS.NET in our project.
I should note that the project we're having this problem in is the same one as #640. However, I reinstalled Windows and everything else since and got it to work on my machine. However, Zak had to do the same thing and ran into the problems described in this issue.
Is this project still being maintained? We would really appreciate a response here.
Nope, sorry. I do this in my free time (unpaid) and haven’t had the motivation to come back to it in a while. :)
If you do find a fix let me know and I’ll see if we can merge something in…
On Tue, Apr 27, 2021 at 18:14, Adam Ford @.***> wrote:
Is this project still being maintained? We would really appreciate a response here.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/reactjs/React.NET/issues/1236#issuecomment-827970861, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHGCFVAC5Q5LKWVCL52CZLTK4ZNJANCNFSM4V24KRPA .
Understandable. Thank you for the response.
On Tue, Apr 27, 2021 at 5:33 PM Masters @.***> wrote:
Nope, sorry. I do this in my free time (unpaid) and haven’t had the motivation to come back to it in a while. :)
If you do find a fix let me know and I’ll see if we can merge something in…
On Tue, Apr 27, 2021 at 18:14, Adam Ford @.***> wrote:
Is this project still being maintained? We would really appreciate a response here.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <https://github.com/reactjs/React.NET/issues/1236#issuecomment-827970861 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AAHGCFVAC5Q5LKWVCL52CZLTK4ZNJANCNFSM4V24KRPA
.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/reactjs/React.NET/issues/1236#issuecomment-828023324, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABKV3NLVAERDOOLM4QFFADTK5CVZANCNFSM4V24KRPA .