A procedure imported by 'ClearScriptV8-64.dll' could not be loaded.

Jun 20, 2014 at 11:40 AM
Edited Jun 21, 2014 at 12:44 PM
This is in web and all works fine if I build and w3wp.exe is not running. If I build while the w3wp.exe is running, I get the above error. Then I kill the w3wp.exe reload site and it's all great.

The project setup is:
  • VS 2012
  • Web (mvc 5)
  • Library (where ClearScript is)
I reference the Library in Web and I add to Web ClearScript.V8 and ClearScript.Manager from NuGet.

Thanks!
Coordinator
Jun 21, 2014 at 6:27 PM
Hello scuty,

We haven't seen this message before. Is it happening during the build, or after the build when requests come in? A call stack could be very useful.

Thanks!
Jun 21, 2014 at 6:46 PM
It happens if I do this: I build and I open an request and it's all good, then I make a change in the Library (where ClearScript is) and then I debug and I make an request and it dies.

This is the call stack:
[FileLoadException: A procedure imported by 'ClearScriptV8-64.DLL' could not be loaded.]
   System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +210
   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +44
   System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark) +155
   System.Reflection.Assembly.LoadFrom(String assemblyFile) +61
   WebActivatorEx.ActivationManager.get_Assemblies() +282
   WebActivatorEx.ActivationManager.RunActivationMethods(Boolean designerMode) +88
   WebActivatorEx.ActivationManager.RunPreStartMethods(Boolean designerMode) +47
   WebActivatorEx.ActivationManager.Run() +70

[InvalidOperationException: The pre-application start initialization method Run on type WebActivatorEx.ActivationManager threw an exception with the following error message: A procedure imported by 'ClearScriptV8-64.DLL' could not be loaded..]
   System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +12602895
   System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +12602616
   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +280
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +172
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1151

[HttpException (0x80004005): The pre-application start initialization method Run on type WebActivatorEx.ActivationManager threw an exception with the following error message: A procedure imported by 'ClearScriptV8-64.DLL' could not be loaded..]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12601936
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12441597
Coordinator
Jun 23, 2014 at 1:18 PM
Hi scuty,

Unfortunately we can't be of much help here. There are no ClearScript frames within the stacks you provided, and the fact that everything works when you restart the web worker indicates that ClearScript is set up and functioning correctly.

The ASP.NET environment has always been somewhat problematic for ClearScript due to its reliance on mixed-mode and native assemblies. It's possible that ClearScript is incompatible with the "live build" workflow you're using, at least given your current configuration. Also, although we haven't encountered the specific error you're seeing, the ClearScript.V8 NuGet package has known issues with ASP.NET. Please see the long thread here for a discussion of ASP.NET issues and potential solutions.

Good luck!
Jun 23, 2014 at 2:08 PM
Thanks for your time.

Do you think that if I use .NET 4.5 would create this problem? I downloaded the project and it's using 4.0.
Coordinator
Jun 24, 2014 at 6:56 PM
Hi scuty,

We have no reason to believe that .NET 4.5 is the cause of this issue, but it's difficult to be sure without knowing the true cause.

By the way, the ClearScript ReadMe contains our recommended procedure for integrating ClearScript into ASP.NET projects, and the discussion thread linked above includes our suggestions for users of the ClearScript.V8 NuGet package.

Good luck!
Jun 24, 2014 at 9:31 PM
Hi,

Doing what the ReadMe said solved the problem. Thanks! Great project!
Jul 16, 2015 at 10:20 PM
Hey scuty - I know this was a year ago but can you elaborate on exactly what fixed this for you?

Thanks
Jul 20, 2015 at 4:11 PM
Do you still need help with this?