Taritsyn/JavaScriptEngineSwitcher

Cannot load V8 interface assembly. Load failure information for ClearScriptV8-64.dll

ArgonAlex opened this issue · 14 comments

d:\git\mysite\bin\x64\ClearScriptV8-64.dll: Could not load file or assembly 'ClearScriptV8-64.dll' or one of its dependencies. The specified module could not be found.

I'm attempting to upgrade from JavaScriptEngineSwitcher 3.1.5 to 3.3.0 and seeing this exception. Visual C++ Redistributable 2019 is installed and I even tried upgrading it to the latest version.

JavaScriptEngineSwitcher.Core, JavaScriptEngineSwitcher.V8, JavaScriptEngineSwitcher.V8.Native.win-x64
are all on 3.3.0 and everything in the bin directory looks good. d:\git\mysite\bin\x64\ClearScriptV8-64.dll exists and it is version 6.0.0

This is happening on a dev environment with Visual Studio 2019 installed, and on a clean staging environment with just the essentials, including Visual C++ Redistributable 2019.

Environment Info:
x64 web application project, targeting .NET 4.7.1
Paket package manager
Windows Server 2019

Hello, Alex!

What ASP.NET framework do you use?

It's an ASP.NET Web Application, targeting .NET Framework 4.7.1

MVC or Web Forms?

Primarily Web Forms for pages, but also some MVC for API endpoints.

I checked on MVC and I didn't have any problems.

The following assemblies must be located in the bin\x64\ directory:

  • ClearScriptV8-64.dll
  • v8-base-x64.dll
  • v8-libcpp-x64.dll
  • v8-x64.dll

Yup those are all there and are the correct versions. I've also gone as far as using Process Monitor to see that all of the DLLs under bin/x64 are in fact being read.

I just created a new Web Forms ASP.NET Web Application and it works for me too. There must be something specific about the way our particular application is configured, but I don't know why it worked for many previous versions of JSES/ClearScript and is only just failing on this one.

Other things I've tried:

  • Upgrading Visual C++ Redistributable 2019 to the latest version
  • iisreset
  • Clearing out Temporary ASP.NET Files
  • Rebooting the whole machine

Not sure where to go from here. I wish Microsoft would give a more useful reason for why it can't load the DLL other than FileNotFound.

Good(ish) news! I decided to copy over the web.config from the non-working application to the new one, and voila I saw the same exception. After doing a binary search of commenting out config sections, commenting out this made it so the DLL could be successfully loaded:
<identity impersonate="true"/>
So I think it must be something related to permissions.

In any case, this seems like a problem with ClearScript, not so much with JSES. Maybe I'll post an issue on the ClearScript repo.

Hello, Alex!

In version 3.3.0 I changed the mechanism of assembly loading in the AssemblyResolver class. This mechanism now relies on the internal implementation of the ClearScript library.

Ah that would explain why I was running into the same problem with the Microsoft.ClearScript NuGet package, even the older versions of it.

Microsoft.ClearScript NuGet package uses a different directory structure, so it was never compatible with the JavaScriptEngineSwitcher.V8 module.

I meant when I removed JSES from the project and just used ClearScript directly, I had the same issue with being unable to load ClearScriptV8-64.dll, so it certainly seems like an issue there.

Most likely, these problems are somewhere in the V8Proxy class.

An update for anyone else who comes across this: our solution was to force the assembly to load during Application_Start instead of during the first request. Under that context it seemed to have the necessary permissions.

In other news, it looks like ClearScript 6.0.1, released today, fixes some possibly related permission issues when loading the assemblies. So that may also fix it.

Anyway, I'm going to close this issue since it's a ClearScript issue, and there is a workaround/it may be fixed.

Hello, Alex!

In version 3.5.1 added support of Microsoft ClearScript.V8 version 6.0.1.