Skip to content
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

Unable to load one or more of the requested types. #611

Closed
olaj opened this issue Oct 17, 2018 · 1 comment
Closed

Unable to load one or more of the requested types. #611

olaj opened this issue Oct 17, 2018 · 1 comment

Comments

@olaj
Copy link

olaj commented Oct 17, 2018

I have seen some other posts about this error but i can't figure out how to solve it.

I have implemented ReactJS.net according to the tutorial.

`using React;

[assembly: WebActivatorEx.PreApplicationStartMethod(typeof(AlternativeTo.ReactConfig), "Configure")]

namespace AlternativeTo {
public static class ReactConfig {
public static void Configure() {
ReactSiteConfiguration.Configuration
.AddScript("~/ReactTest/like_button.js");
}
}
}`

I have installed the nuget packages and so on but the first thing that happens when i load the project is that i get.

[ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.] System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) +0 System.Reflection.RuntimeModule.GetTypes() +9 System.Reflection.Assembly.GetTypes() +61 React.<>c.<InitializeIoC>b__2_0(Assembly assembly) +12 System.Linq.<SelectManyIterator>d__172.MoveNext() +170
System.Linq.WhereEnumerableIterator1.MoveNext() +87 React.Initializer.InitializeIoC(Func2 requestLifetimeRegistration) +275
React.Web.WebInitializer.Initialize() +43

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +87
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +101
WebActivatorEx.BaseActivationMethodAttribute.InvokeMethod() +73
WebActivatorEx.ActivationManager.RunActivationMethods(Boolean designerMode) +637
WebActivatorEx.ActivationManager.Run() +101

[InvalidOperationException: The pre-application start initialization method Run on type WebActivatorEx.ActivationManager threw an exception with the following error message: Exception has been thrown by the target of an invocation..]
System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection1 methods, Func1 setHostingEnvironmentCultures) +614
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +138
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +163
System.Web.Compilation.BuildManager.ExecutePreAppStart() +156
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +695

[HttpException (0x80004005): The pre-application start initialization method Run on type WebActivatorEx.ActivationManager threw an exception with the following error message: Exception has been thrown by the target of an invocation..]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +658
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +89
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +189`

If I change the IIS App Pool to disable support for 32bit i get this error instead.

`[TinyIoCResolutionException: Unable to resolve type: React.IReactEnvironment]
React.TinyIoC.TinyIoCContainer.ResolveInternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options) +821
React.TinyIoC.TinyIoCContainer.Resolve() +46
React.ReactEnvironment.get_GetCurrentOrThrow() +66

[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() +158
React.Web.Mvc.<>c__DisplayClass2_01.<React>b__0(TextWriter writer) +359 React.Web.Mvc.ActionHtmlString.ToHtmlString() +201 System.Web.WebPages.WebPageBase.Write(Object value) +103 ASP._Page_Views_Start_Index_cshtml.Execute() in c:\GitHub\AlternativeTo\AlternativeTo2\AlternativeToWeb\Views\Start\Index.cshtml:85 System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +252 System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +148 System.Web.WebPages.StartPage.ExecutePageHierarchy() +86 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +107 StackExchange.Profiling.Mvc.WrappedView.Render(ViewContext viewContext, TextWriter writer) +160 System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +375 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +88
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +775 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList1 filters, ActionResult actionResult) +81
System.Web.Mvc.Async.<>c__DisplayClass3_1.b__5(IAsyncResult asyncResult) +188
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
System.Web.Mvc.<>c.b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState) +26
System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +73 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +39
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
System.Web.Mvc.<>c.b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState) +40
System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +73 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +648 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +213 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +131

As far as i understand it seems to have something todo with the "JavascriptEngineSwitcher" but i have no idea how to solve it? #414 this thread seems to mention something about setting a default engine but where do i do that and what should i use?

I have read #409 but tbh i dont not really understand what actions i should take based on that.

Sorry but i'm also new to this library and new to JavascriptEngineSwitcher so i don't have that much background information. Let me know if you need more code and so on.

@dustinsoftware
Copy link
Member

There is a getting started page that may be helpful here.. would you mind trying to build one of the sample projects in this repo? Those show how to set up ReactJS.NET correctly.

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