sebastienros / jint

Javascript Interpreter for .NET
BSD 2-Clause "Simplified" License
4.11k stars 563 forks source link

The type initializer for 'Jint.Native.Global.GlobalObject' threw an exception. #1838

Closed KoalaBear84 closed 6 months ago

KoalaBear84 commented 6 months ago

Just as a reference if someone else runs into this.

Version used

Checked with 3.0.0 and 3.1.0.

Describe the bug

When getting an exception with just this code:

Engine jintEngine = new Engine();

The type initializer for 'Jint.Native.Global.GlobalObject' threw an exception.

   at Jint.Native.Global.GlobalObject.Initialize()
   at Jint.Runtime.Host.CreateGlobalObject(Realm realm)
   at Jint.Runtime.Host.CreateRealm()
   at Jint.Runtime.Host.InitializeHostDefinedRealm()
   at Jint.Runtime.Host.Initialize(Engine engine)
   at Jint.Engine..ctor(Options options, Action`2 configure)

To Reproduce

Engine jintEngine = new Engine();

Expected behavior

No exceptions.

Additional context

Running in a SAAS environment on Azure.

FIX

After adding System.Memory.dll with version 4.6.31308.1, at least for Jint 3.1.0 it worked.