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" server error after JavaScriptEngineSwitcher upgrade to 2.4.0 #417

Closed
roman-yagodin opened this issue Jun 21, 2017 · 5 comments

Comments

@roman-yagodin
Copy link

roman-yagodin commented Jun 21, 2017

Error message:

Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

Stack trace:

[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.Assembly.GetTypes() +118
   System.Linq.<SelectManyIterator>d__16`2.MoveNext() +293
   System.Linq.WhereEnumerableIterator`1.MoveNext() +108
   React.Initializer.InitializeIoC(Func`2 requestLifetimeRegistration) +409
   React.Web.WebInitializer.Initialize() +71

[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) +260
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +146
   WebActivatorEx.BaseActivationMethodAttribute.InvokeMethod() +102
   WebActivatorEx.ActivationManager.RunActivationMethods(Boolean designerMode) +718
   WebActivatorEx.ActivationManager.Run() +125

[InvalidOperationException: Метод инициализации перед запуском приложения (Run) в типе WebActivatorEx.ActivationManager вызвал исключение со следующим сообщением об ошибке: Exception has been thrown by the target of an invocation..]
   System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +874
   System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +169
   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +166
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +176
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +882

[HttpException (0x80004005): Метод инициализации перед запуском приложения (Run) в типе WebActivatorEx.ActivationManager вызвал исключение со следующим сообщением об ошибке: Exception has been thrown by the target of an invocation..]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +579
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +112
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +712

React.Core 3.0.1 and React.Web 3.0.1 installed from NuGet.

Upgraded packages:

JavaScriptEngineSwitcher.Core 2.4.0
JavaScriptEngineSwitcher.Jint 2.4.0
JavaScriptEngineSwitcher.Msie 2.4.0
JavaScriptEngineSwitcher.Jurassic 2.4.2
JavaScriptEngineSwitcher.V8 2.4.2
JavaScriptEngineSwitcher.ChakraCore 2.4.6
MsieJavaScriptEngine 2.2.1

All upgraded assemblies copied into website bin folder.

Only Jurassic and Jint registered, both worked fine before JavaScriptSwitcher upgrade:

var engineSwither = JsEngineSwitcher.Instance;
engineSwither.EngineFactories.AddJurassic ();
engineSwither.EngineFactories.AddJint ();
engineSwither.DefaultEngineName = JurassicJsEngine.EngineName;
@Taritsyn
Copy link
Contributor

Hello, Roman!

Already there was a similar error - “Updating JavascriptEngineSwitcher.V8 breaks React.Net”.

Also I recommend you to read the “Misconceptions about the JavaScript Engine Switcher version 2.X” discussion.

@Taritsyn
Copy link
Contributor

It's also very similar to the fact, that you did not install packages with native assemblies.

@roman-yagodin
Copy link
Author

roman-yagodin commented Jun 21, 2017

@Taritsyn, thanks for the quick response!

I've noticed that setting DefaultEngineName property not working as expected and I need to add the engine factory I wish to use as the first one...

For now, I still cannot influence the way ReactJS.NET seeking for required assemblies by registering JS engine factories manually. Do I still need to install native assemblies for V8 and ChakraCore engines even if I not register factories for them?

@Taritsyn
Copy link
Contributor

I've noticed that setting DefaultEngineName property not working as expected and I need to add the engine factory I wish to use as the first one...

Read about this problem in Daniel's comment. If you want to solve this problem, then vote for my pull request - “Added a ability to select the default JavaScript engine”.

Do I still need to install native assemblies for V8 and ChakraCore engines even if I not register factories for them?

Not necessary.

@roman-yagodin
Copy link
Author

Resolved in 3.1.0 release

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