Taritsyn / JavaScriptEngineSwitcher

JavaScript Engine Switcher determines unified interface for access to the basic features of popular JavaScript engines. This library allows you to quickly and easily switch to using of another JavaScript engine.
Apache License 2.0
440 stars 49 forks source link

JavaScriptEngineSwitcher.V8 NuGet package incompatible with .NET Core #61

Closed Zenexer closed 5 years ago

Zenexer commented 5 years ago

I'm attempting to use V8 with .NET Core 2.1. ChakraCore works, more or less, but whenever I try to use V8:

System.MissingMethodException: Method not found: 'System.AppDomainSetup System.AppDomain.get_SetupInformation()'.
   at JavaScriptEngineSwitcher.V8.AssemblyResolver.AssemblyResolveHandler(Object sender, ResolveEventArgs args)
   at System.AppDomain.InvokeResolveEvent(ResolveEventHandler eventHandler, RuntimeAssembly assembly, String name)

System.IO.FileLoadException: Could not load file or assembly 'ClearScriptV8, Culture=neutral, PublicKeyToken=null'. Method does not exist. (Exception from HRESULT: 0x80131513)
File name: 'ClearScriptV8, Culture=neutral, PublicKeyToken=null' ---> System.MissingMethodException: Method not found: 'System.AppDomainSetup System.AppDomain.get_SetupInformation()'.
   at JavaScriptEngineSwitcher.V8.AssemblyResolver.AssemblyResolveHandler(Object sender, ResolveEventArgs args)
   at System.AppDomain.InvokeResolveEvent(ResolveEventHandler eventHandler, RuntimeAssembly assembly, String name)
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, IntPtr ptrLoadContextBinder)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, IntPtr ptrLoadContextBinder)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, StackCrawlMark& stackMark, IntPtr pPrivHostBinder)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, StackCrawlMark& stackMark)
   at System.Reflection.Assembly.Load(String assemblyString)
   at Microsoft.ClearScript.V8.V8Proxy.LoadAssembly()
   at Microsoft.ClearScript.V8.V8Proxy.GetAssembly()
   at Microsoft.ClearScript.V8.V8Proxy.GetImplType(Type type)
   at Microsoft.ClearScript.V8.V8Proxy.CreateImpl[T](Object[] args)
   at Microsoft.ClearScript.V8.V8Runtime..ctor(String name, V8RuntimeConstraints constraints, V8RuntimeFlags flags, Int32 debugPort)
   at Microsoft.ClearScript.V8.V8ScriptEngine..ctor(V8Runtime runtime, String name, V8RuntimeConstraints constraints, V8ScriptEngineFlags flags, Int32 debugPort)
   at JavaScriptEngineSwitcher.V8.V8JsEngine..ctor(V8Settings settings)

I noticed that I get a warning for the JavaScriptEngineSwitcher.V8 NuGet dependency:

Package 'JavaScriptEngineSwitcher.V8 2.4.13' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project.

Sure enough, the NuGet package requires .NET Framework v4.0 or v4.5:

image

Am I correct in assuming that JavaScriptEngineSwitcher.V8 is incompatible with .NET Core?

Taritsyn commented 5 years ago

Hello, Paul!

Am I correct in assuming that JavaScriptEngineSwitcher.V8 is incompatible with .NET Core?

Yes, you understood correctly. There is even a note in the README.md file:

JavaScriptEngineSwitcher.V8 module is based on the Microsoft ClearScript.V8 library that is not yet compatible with .NET Core.

rjamesnw commented 5 years ago

FYI: V8.Net is now .Net Standard (core) compatible.