Are you the publisher? Claim or contact us about this channel


Embed this content in your HTML

Search

Report adult content:

click to rate:

Account: (login)

More Channels


Showcase


Channel Catalog


Channel Description:

ClearScript is a library that makes it easy to add scripting to your .NET applications. It currently supports JavaScript (via V8 and JScript) and VBScript.

older | 1 | .... | 112 | 113 | (Page 114) | 115 | newer

    0 0

    Hi Jesper,

    For these functions to work, you must provide an implementation of Microsoft.ClearScript.Windows.IHostWindow. Here's a minimal example:
    internalclass HostWindow : IHostWindow {
        public IntPtr OwnerHandle {
            get { return IntPtr.Zero; }
        }
        publicvoid EnableModeless(bool enable) {
            thrownew NotImplementedException();
        }
    }
    And then:
    engine.HostWindow = new HostWindow();
    engine.Execute("result = MsgBox(\"Ready?\", vbQuestion + vbYesNo, \"Let's Go!\")");
    You can download ClearScript's API reference here.

    Good luck!

    0 0

    Hi,

    Using React.NET 3.0.1 which uses ClearScript.V8 5.4.8 following hang is observed on recycling application pool
    ```
    .NET Call Stack


    .SharedPtr.Release(SharedPtr*)+d7
    [[InlinedCallFrame] (.Decrement)] .RefCount.Decrement(RefCount*)
    Microsoft.ClearScript.V8.V8ContextProxyImpl.!V8ContextProxyImpl()+4e
    Microsoft.ClearScript.V8.V8ContextProxyImpl.Dispose(Boolean)+1f
    [[DebuggerU2MCatchHandlerFrame]]
    [[ContextTransitionFrame]]
    [[GCFrame]]
    [[DebuggerU2MCatchHandlerFrame]]

    Full Call Stack

    ntdll!NtWaitForSingleObject+14
    KERNELBASE!WaitForSingleObjectEx+8f
    v8_x64!v8::Extension::dependencies+329ac
    v8_x64!v8::ExternalResourceVisitor::VisitExternalString+28187
    v8_x64!v8::ExternalResourceVisitor::VisitExternalString+1a3
    v8_x64!v8::ExternalResourceVisitor::VisitExternalString+533b
    ClearScriptV8_64+14216
    ClearScriptV8_64+120e4
    ClearScriptV8_64+13e3f
    ClearScriptV8_64+50a8
    <Module>.SharedPtr<V8Context>.Release(SharedPtr<V8Context>*)+d7
    [[InlinedCallFrame] (<Module>.Decrement)] <Module>.RefCount.Decrement(RefCount*)
    Microsoft.ClearScript.V8.V8ContextProxyImpl.!V8ContextProxyImpl()+4e
    Microsoft.ClearScript.V8.V8ContextProxyImpl.Dispose(Boolean)+1f
    clr!FastCallFinalizeWorker+6
    clr!ETW::GCLog::SendFinalizeObjectEvent+c9
    clr!MethodTable::CallFinalizer+b5
    clr!CallFinalizer+5e
    clr!FinalizerThread::DoOneFinalization+95
    clr!FinalizerThread::FinalizeAllObjects+133
    clr!FinalizerThread::FinalizeAllObjects_Wrapper+18
    clr!Frame::Push+59
    clr!PEDecoder::GetNativeCodeManagerTable+170
    clr!PEDecoder::GetNativeCodeManagerTable+99
    [[DebuggerU2MCatchHandlerFrame]]
    clr!Thread::ShouldChangeAbortToUnload+45
    clr!Thread::DoADCallBack+109
    [[ContextTransitionFrame]]
    clr!Frame::Push+a2
    clr!FinalizerThread::DoOneFinalization+1f9
    [[GCFrame]]
    clr!FinalizerThread::FinalizeAllObjects+133
    clr!FinalizerThread::FinalizerThreadWorker+bb
    clr!Frame::Push+59
    clr!PEDecoder::GetNativeCodeManagerTable+170
    clr!PEDecoder::GetNativeCodeManagerTable+99
    [[DebuggerU2MCatchHandlerFrame]]
    clr!FinalizerThread::FinalizerThreadStart+10a
    clr!Thread::intermediateThreadProc+86
    kernel32!BaseThreadInitThunk+14
    ntdll!RtlUserThreadStart+21
    ```

    0 0

    Thanks ! Now it's working.

    Regards Jesper Sandgaard

    0 0
  • 03/29/17--12:33: New Post: Native Visual C++
  • In the Description it says "ClearScript is a library that makes it easy to add scripting to your .NET applications.". How about native vc++? Is it possible to use ClearScript with unmanaged c++ code?

    0 0

    Hi,

    I have a JS script, which I cannot change and I need to execute it to get a result. I successfully passed some objects into the engine but I have a problem with arrays. Since I have no control over the script itself, the input objects have to be converted into compatible JS objects.

    How can I convert .net array into JS array without modification of the script?

    Inside the script I have to be able to access the array.length property, but .net Array, which is passed in has Array.Length property (and misses another functions).

    Thank you
    Petr

    0 0
  • 03/30/17--08:25: New Post: Native Visual C++
  • Hi Hrnkas,

    Thanks for your question!

    ClearScript's main goal is to make existing .NET objects and types scriptable with minimal effort. To that end it relies heavily on .NET features such as reflection and the C# compiler. Without those facilities it couldn't fulfill its primary purpose, so it's unclear what value ClearScript would bring to a purely unmanaged environment.

    The script engines that ClearScript supports all have unmanaged public APIs. Have you considered embedding one of them directly?

    Cheers!

    0 0

    Hello Petr,

    How can I convert .net array into JS array without modification of the script?

    You can use the script engine as a helper. Here's a simple extension method that converts a .NET collection to a JavaScript array:
    internalstaticclass EnumerableExtensions {
        publicstaticobject ToScriptArray<T>(this IEnumerable<T> collection, ScriptEngine engine) {
            dynamic array = engine.Evaluate("([])");
            foreach (var item in collection) {
                array.push(item);
            }
            return array;
        }
    }
    And here's how you might use it:
    var foo = Enumerable.Range(100, 10);
    engine.Script.foo = foo.ToScriptArray(engine);
    engine.Execute(@"
        for (var i = 0; i < foo.length; ++i) {
            var item = foo[i];
            // do something
        }
    ");
    Another possibility might be to use a wrapper to make your collection look more like a JavaScript array:
    publicclass ArrayLikeWrapper : ArrayList {
        public ArrayLikeWrapper(IEnumerable collection) {
            foreach (var item in collection) {
                Add(item);
            }
        }
        publicint length => Count;
        publicint push(object item) {
            return Add(item) + 1;
        }
    }
    And then:
    var foo = Enumerable.Range(100, 10);
    engine.Script.foo = new ArrayLikeWrapper(foo);
    // etc.
    So there's more than one way to do it.

    Good luck!

    0 0

    Thank you very much. Since I need to be maximally compatible with JS, I chose the first option and it works.

    0 0
  • 04/03/17--08:46: Updated Wiki: Home
  • Description

    ClearScript is a library that makes it easy to add scripting to your .NET applications. It currently supports JavaScript (via V8 and JScript) and VBScript.

    Features

    • Simple usage; create a script engine, add your objects and/or types, run scripts
    • Support for several script engines: Google's V8, Microsoft's JScript and VBScript
    • Exposed resources require no modification, decoration, or special coding of any kind
    • Scripts get simple access to most of the features of exposed objects and types:
      • Methods, properties, fields, events
      • (Objects) Indexers, extension methods, conversion operators, explicitly implemented interfaces
      • (Types) Constructors, nested types
    • Full support for generic types and methods, including C#-like type inference and explicit type arguments
    • Scripts can invoke methods with output parameters, optional parameters, and parameter arrays
    • Script delegates enable callbacks into script code
    • Support for exposing all the types defined in one or more assemblies in one step
    • Optional support for importing types and assemblies from script code
    • The host can invoke script functions and access script objects directly
    • Full support for script debugging

    Examples

    using System;
    using Microsoft.ClearScript;
    using Microsoft.ClearScript.JavaScript;
    using Microsoft.ClearScript.V8;
    
    // create a script engineusing (var engine = new V8ScriptEngine())
    {
        // expose a host type
        engine.AddHostType("Console", typeof(Console));
        engine.Execute("Console.WriteLine('{0} is an interesting number.', Math.PI)");
    
        // expose a host object
        engine.AddHostObject("random", new Random());
        engine.Execute("Console.WriteLine(random.NextDouble())");
    
        // expose entire assemblies
        engine.AddHostObject("lib", new HostTypeCollection("mscorlib", "System.Core"));
        engine.Execute("Console.WriteLine(lib.System.DateTime.Now)");
    
        // create a host object from script
        engine.Execute(@"
            birthday = new lib.System.DateTime(2007, 5, 22);
            Console.WriteLine(birthday.ToLongDateString());
        ");
    
        // use a generic class from script
        engine.Execute(@"
            Dictionary = lib.System.Collections.Generic.Dictionary;
            dict = new Dictionary(lib.System.String, lib.System.Int32);
            dict.Add('foo', 123);
        ");
    
        // call a host method with an output parameter
        engine.AddHostObject("host", new HostFunctions());
        engine.Execute(@"
            intVar = host.newVar(lib.System.Int32);
            found = dict.TryGetValue('foo', intVar.out);
            Console.WriteLine('{0} {1}', found, intVar);
        ");
    
        // create and populate a host array
        engine.Execute(@"
            numbers = host.newArr(lib.System.Int32, 20);
            for (var i = 0; i < numbers.Length; i++) { numbers[i] = i; }
            Console.WriteLine(lib.System.String.Join(', ', numbers));
        ");
    
        // create a script delegate
        engine.Execute(@"
            Filter = lib.System.Func(lib.System.Int32, lib.System.Boolean);
            oddFilter = new Filter(function(value) {
                return (value & 1) ? true : false;
            });
        ");
    
        // use LINQ from script
        engine.Execute(@"
            oddNumbers = numbers.Where(oddFilter);
            Console.WriteLine(lib.System.String.Join(', ', oddNumbers));
        ");
    
        // use a dynamic host object
        engine.Execute(@"
            expando = new lib.System.Dynamic.ExpandoObject();
            expando.foo = 123;
            expando.bar = 'qux';
            delete expando.foo;
        ");
    
        // call a script function
        engine.Execute("function print(x) { Console.WriteLine(x); }");
        engine.Script.print(DateTime.Now.DayOfWeek);
    
        // examine a script object
        engine.Execute("person = { name: 'Fred', age: 5 }");
        Console.WriteLine(engine.Script.person.name);
    
        // read a JavaScript typed array
        engine.Execute("values = new Int32Array([1, 2, 3, 4, 5])");
        var values = (ITypedArray<int>)engine.Script.values;
        Console.WriteLine(string.Join(", ", values.ToArray()));
    }

    0 0

    Hi,

    Using React.NET 3.0.1 which uses ClearScript.V8 5.4.8 following hang is observed on recycling application pool
    ```
    .NET Call Stack


    .SharedPtr.Release(SharedPtr*)+d7
    [[InlinedCallFrame] (.Decrement)] .RefCount.Decrement(RefCount*)
    Microsoft.ClearScript.V8.V8ContextProxyImpl.!V8ContextProxyImpl()+4e
    Microsoft.ClearScript.V8.V8ContextProxyImpl.Dispose(Boolean)+1f
    [[DebuggerU2MCatchHandlerFrame]]
    [[ContextTransitionFrame]]
    [[GCFrame]]
    [[DebuggerU2MCatchHandlerFrame]]

    Full Call Stack

    ntdll!NtWaitForSingleObject+14
    KERNELBASE!WaitForSingleObjectEx+8f
    v8_x64!v8::Extension::dependencies+329ac
    v8_x64!v8::ExternalResourceVisitor::VisitExternalString+28187
    v8_x64!v8::ExternalResourceVisitor::VisitExternalString+1a3
    v8_x64!v8::ExternalResourceVisitor::VisitExternalString+533b
    ClearScriptV8_64+14216
    ClearScriptV8_64+120e4
    ClearScriptV8_64+13e3f
    ClearScriptV8_64+50a8
    <Module>.SharedPtr<V8Context>.Release(SharedPtr<V8Context>*)+d7
    [[InlinedCallFrame] (<Module>.Decrement)] <Module>.RefCount.Decrement(RefCount*)
    Microsoft.ClearScript.V8.V8ContextProxyImpl.!V8ContextProxyImpl()+4e
    Microsoft.ClearScript.V8.V8ContextProxyImpl.Dispose(Boolean)+1f
    clr!FastCallFinalizeWorker+6
    clr!ETW::GCLog::SendFinalizeObjectEvent+c9
    clr!MethodTable::CallFinalizer+b5
    clr!CallFinalizer+5e
    clr!FinalizerThread::DoOneFinalization+95
    clr!FinalizerThread::FinalizeAllObjects+133
    clr!FinalizerThread::FinalizeAllObjects_Wrapper+18
    clr!Frame::Push+59
    clr!PEDecoder::GetNativeCodeManagerTable+170
    clr!PEDecoder::GetNativeCodeManagerTable+99
    [[DebuggerU2MCatchHandlerFrame]]
    clr!Thread::ShouldChangeAbortToUnload+45
    clr!Thread::DoADCallBack+109
    [[ContextTransitionFrame]]
    clr!Frame::Push+a2
    clr!FinalizerThread::DoOneFinalization+1f9
    [[GCFrame]]
    clr!FinalizerThread::FinalizeAllObjects+133
    clr!FinalizerThread::FinalizerThreadWorker+bb
    clr!Frame::Push+59
    clr!PEDecoder::GetNativeCodeManagerTable+170
    clr!PEDecoder::GetNativeCodeManagerTable+99
    [[DebuggerU2MCatchHandlerFrame]]
    clr!FinalizerThread::FinalizerThreadStart+10a
    clr!Thread::intermediateThreadProc+86
    kernel32!BaseThreadInitThunk+14
    ntdll!RtlUserThreadStart+21
    ```
    Comments: Hi, Sorry for delay. Stack with symbols loaded for locally built version: ``` # Child-SP RetAddr Call Site 00 000000eb`4437ed78 00007ffa`f9c4988f ntdll!ZwWaitForSingleObject+0x14 01 000000eb`4437ed80 00007ffa`bb02554c KERNELBASE!WaitForSingleObjectEx+0x9f 02 (Inline Function) --------`-------- v8_x64!v8::internal::MemoryAllocator::Unmapper::WaitUntilCompleted+0x16 [c:\git\clearscript\clearscript\v8\v8\build\v8-x64\src\heap\spaces.cc @ 366] 03 000000eb`4437ee20 00007ffa`bad9e237 v8_x64!v8::internal::MemoryAllocator::TearDown+0x3c [c:\git\clearscript\clearscript\v8\v8\build\v8-x64\src\heap\spaces.cc @ 314] 04 000000eb`4437ee60 00007ffa`bad76283 v8_x64!v8::internal::Heap::TearDown+0x477 [c:\git\clearscript\clearscript\v8\v8\build\v8-x64\src\heap\heap.cc @ 5591] 05 000000eb`4437eea0 00007ffa`bad7b41b v8_x64!v8::internal::Isolate::Deinit+0x193 [c:\git\clearscript\clearscript\v8\v8\build\v8-x64\src\isolate.cc @ 2150] 06 000000eb`4437eed0 00007ffa`d0074216 v8_x64!v8::internal::Isolate::TearDown+0x5b [c:\git\clearscript\clearscript\v8\v8\build\v8-x64\src\isolate.cc @ 2077] 07 000000eb`4437ef10 00007ffa`d00720e4 ClearScriptV8_64!V8IsolateImpl::~V8IsolateImpl+0x286 [c:\git\clearscript\clearscript\v8\clearscriptv8\v8isolateimpl.cpp @ 656] 08 000000eb`4437eff0 00007ffa`d0073e3f ClearScriptV8_64!V8IsolateImpl::`scalar deleting destructor'+0x14 09 (Inline Function) --------`-------- ClearScriptV8_64!SharedPtrTraits<V8IsolateImpl>::Destroy+0xe [c:\git\clearscript\clearscript\v8\clearscriptv8\sharedptr.h @ 143] 0a (Inline Function) --------`-------- ClearScriptV8_64!SharedPtr<V8IsolateImpl>::Release+0x23 [c:\git\clearscript\clearscript\v8\clearscriptv8\sharedptr.h @ 338] 0b (Inline Function) --------`-------- ClearScriptV8_64!SharedPtr<V8IsolateImpl>::{dtor}+0x23 [c:\git\clearscript\clearscript\v8\clearscriptv8\sharedptr.h @ 259] 0c 000000eb`4437f020 00007ffa`d00650a8 ClearScriptV8_64!V8IsolateImpl::CallWithLockNoWait+0x1df [c:\git\clearscript\clearscript\v8\clearscriptv8\v8isolateimpl.cpp @ 628] 0d 000000eb`4437f0d0 00007ffa`84f451fb ClearScriptV8_64!V8ContextImpl::Destroy+0x68 [c:\git\clearscript\clearscript\v8\clearscriptv8\v8contextimpl.cpp @ 530] 0e 000000eb`4437f160 00007ffa`84f7121e 0x00007ffa`84f451fb 0f 000000eb`4437f210 00007ffa`84f47d1e 0x00007ffa`84f7121e 10 000000eb`4437f2c0 00007ffa`df5666c6 0x00007ffa`84f47d1e 11 000000eb`4437f300 00007ffa`df71a741 clr!LogHelp_LogAssert+0x1b46 12 000000eb`4437f330 00007ffa`df71a6c9 clr!MetaDataGetDispenser+0x3ff11 13 000000eb`4437f380 00007ffa`df71a602 clr!MetaDataGetDispenser+0x3fe99 14 000000eb`4437f3d0 00007ffa`df71a4b9 clr!MetaDataGetDispenser+0x3fdd2 15 000000eb`4437f410 00007ffa`df71a3cc clr!MetaDataGetDispenser+0x3fc89 16 000000eb`4437f4f0 00007ffa`df71bc87 clr!MetaDataGetDispenser+0x3fb9c 17 000000eb`4437f540 00007ffa`df567c9d clr!MetaDataGetDispenser+0x41457 18 000000eb`4437f570 00007ffa`df567c18 clr!LogHelp_LogAssert+0x311d 19 000000eb`4437f5b0 00007ffa`df567b56 clr!LogHelp_LogAssert+0x3098 1a 000000eb`4437f6b0 00007ffa`df56a864 clr!LogHelp_LogAssert+0x2fd6 1b 000000eb`4437f740 00007ffa`df5b2fe9 clr!LogHelp_LogAssert+0x5ce4 1c 000000eb`4437f770 00007ffa`df56a845 clr!LogHelp_NoGuiOnAssert+0x46dd9 1d 000000eb`4437f920 00007ffa`df71bc33 clr!LogHelp_LogAssert+0x5cc5 1e 000000eb`4437f960 00007ffa`df71a3cc clr!MetaDataGetDispenser+0x41403 1f 000000eb`4437fa40 00007ffa`df71977b clr!MetaDataGetDispenser+0x3fb9c 20 000000eb`4437fa90 00007ffa`df567c9d clr!MetaDataGetDispenser+0x3ef4b 21 000000eb`4437fad0 00007ffa`df567c18 clr!LogHelp_LogAssert+0x311d 22 000000eb`4437fb10 00007ffa`df567b56 clr!LogHelp_LogAssert+0x3098 23 000000eb`4437fc10 00007ffa`df69f87a clr!LogHelp_LogAssert+0x2fd6 24 000000eb`4437fca0 00007ffa`df6631cf clr!PreBindAssemblyEx+0x11aa 25 000000eb`4437fd40 00007ffa`fa102774 clr!GetPrivateContextsPerfCounters+0x10b6f 26 000000eb`4437fe00 00007ffa`fcc00d61 kernel32!BaseThreadInitThunk+0x14 27 000000eb`4437fe30 00000000`00000000 ntdll!RtlUserThreadStart+0x21 ```

    0 0

    Hi,

    Using React.NET 3.0.1 which uses ClearScript.V8 5.4.8 following hang is observed on recycling application pool
    ```
    .NET Call Stack


    .SharedPtr.Release(SharedPtr*)+d7
    [[InlinedCallFrame] (.Decrement)] .RefCount.Decrement(RefCount*)
    Microsoft.ClearScript.V8.V8ContextProxyImpl.!V8ContextProxyImpl()+4e
    Microsoft.ClearScript.V8.V8ContextProxyImpl.Dispose(Boolean)+1f
    [[DebuggerU2MCatchHandlerFrame]]
    [[ContextTransitionFrame]]
    [[GCFrame]]
    [[DebuggerU2MCatchHandlerFrame]]

    Full Call Stack

    ntdll!NtWaitForSingleObject+14
    KERNELBASE!WaitForSingleObjectEx+8f
    v8_x64!v8::Extension::dependencies+329ac
    v8_x64!v8::ExternalResourceVisitor::VisitExternalString+28187
    v8_x64!v8::ExternalResourceVisitor::VisitExternalString+1a3
    v8_x64!v8::ExternalResourceVisitor::VisitExternalString+533b
    ClearScriptV8_64+14216
    ClearScriptV8_64+120e4
    ClearScriptV8_64+13e3f
    ClearScriptV8_64+50a8
    <Module>.SharedPtr<V8Context>.Release(SharedPtr<V8Context>*)+d7
    [[InlinedCallFrame] (<Module>.Decrement)] <Module>.RefCount.Decrement(RefCount*)
    Microsoft.ClearScript.V8.V8ContextProxyImpl.!V8ContextProxyImpl()+4e
    Microsoft.ClearScript.V8.V8ContextProxyImpl.Dispose(Boolean)+1f
    clr!FastCallFinalizeWorker+6
    clr!ETW::GCLog::SendFinalizeObjectEvent+c9
    clr!MethodTable::CallFinalizer+b5
    clr!CallFinalizer+5e
    clr!FinalizerThread::DoOneFinalization+95
    clr!FinalizerThread::FinalizeAllObjects+133
    clr!FinalizerThread::FinalizeAllObjects_Wrapper+18
    clr!Frame::Push+59
    clr!PEDecoder::GetNativeCodeManagerTable+170
    clr!PEDecoder::GetNativeCodeManagerTable+99
    [[DebuggerU2MCatchHandlerFrame]]
    clr!Thread::ShouldChangeAbortToUnload+45
    clr!Thread::DoADCallBack+109
    [[ContextTransitionFrame]]
    clr!Frame::Push+a2
    clr!FinalizerThread::DoOneFinalization+1f9
    [[GCFrame]]
    clr!FinalizerThread::FinalizeAllObjects+133
    clr!FinalizerThread::FinalizerThreadWorker+bb
    clr!Frame::Push+59
    clr!PEDecoder::GetNativeCodeManagerTable+170
    clr!PEDecoder::GetNativeCodeManagerTable+99
    [[DebuggerU2MCatchHandlerFrame]]
    clr!FinalizerThread::FinalizerThreadStart+10a
    clr!Thread::intermediateThreadProc+86
    kernel32!BaseThreadInitThunk+14
    ntdll!RtlUserThreadStart+21
    ```
    Comments: Hi again, Thanks for the stack. Which ClearScript version did you build locally? Thanks!

    0 0

    Hi,

    Using React.NET 3.0.1 which uses ClearScript.V8 5.4.8 following hang is observed on recycling application pool
    ```
    .NET Call Stack


    .SharedPtr.Release(SharedPtr*)+d7
    [[InlinedCallFrame] (.Decrement)] .RefCount.Decrement(RefCount*)
    Microsoft.ClearScript.V8.V8ContextProxyImpl.!V8ContextProxyImpl()+4e
    Microsoft.ClearScript.V8.V8ContextProxyImpl.Dispose(Boolean)+1f
    [[DebuggerU2MCatchHandlerFrame]]
    [[ContextTransitionFrame]]
    [[GCFrame]]
    [[DebuggerU2MCatchHandlerFrame]]

    Full Call Stack

    ntdll!NtWaitForSingleObject+14
    KERNELBASE!WaitForSingleObjectEx+8f
    v8_x64!v8::Extension::dependencies+329ac
    v8_x64!v8::ExternalResourceVisitor::VisitExternalString+28187
    v8_x64!v8::ExternalResourceVisitor::VisitExternalString+1a3
    v8_x64!v8::ExternalResourceVisitor::VisitExternalString+533b
    ClearScriptV8_64+14216
    ClearScriptV8_64+120e4
    ClearScriptV8_64+13e3f
    ClearScriptV8_64+50a8
    <Module>.SharedPtr<V8Context>.Release(SharedPtr<V8Context>*)+d7
    [[InlinedCallFrame] (<Module>.Decrement)] <Module>.RefCount.Decrement(RefCount*)
    Microsoft.ClearScript.V8.V8ContextProxyImpl.!V8ContextProxyImpl()+4e
    Microsoft.ClearScript.V8.V8ContextProxyImpl.Dispose(Boolean)+1f
    clr!FastCallFinalizeWorker+6
    clr!ETW::GCLog::SendFinalizeObjectEvent+c9
    clr!MethodTable::CallFinalizer+b5
    clr!CallFinalizer+5e
    clr!FinalizerThread::DoOneFinalization+95
    clr!FinalizerThread::FinalizeAllObjects+133
    clr!FinalizerThread::FinalizeAllObjects_Wrapper+18
    clr!Frame::Push+59
    clr!PEDecoder::GetNativeCodeManagerTable+170
    clr!PEDecoder::GetNativeCodeManagerTable+99
    [[DebuggerU2MCatchHandlerFrame]]
    clr!Thread::ShouldChangeAbortToUnload+45
    clr!Thread::DoADCallBack+109
    [[ContextTransitionFrame]]
    clr!Frame::Push+a2
    clr!FinalizerThread::DoOneFinalization+1f9
    [[GCFrame]]
    clr!FinalizerThread::FinalizeAllObjects+133
    clr!FinalizerThread::FinalizerThreadWorker+bb
    clr!Frame::Push+59
    clr!PEDecoder::GetNativeCodeManagerTable+170
    clr!PEDecoder::GetNativeCodeManagerTable+99
    [[DebuggerU2MCatchHandlerFrame]]
    clr!FinalizerThread::FinalizerThreadStart+10a
    clr!Thread::intermediateThreadProc+86
    kernel32!BaseThreadInitThunk+14
    ntdll!RtlUserThreadStart+21
    ```
    Comments: I've checked out tag 5.4.8. Here is a stack with SOSex loaded ``` Current frame: ntdll!NtWaitForSingleObject+0x14 Child-SP RetAddr Caller, Callee 000000eb4437ed70 00007ffaf9c4988f KERNELBASE!WaitForSingleObjectEx+0x9f, calling ntdll!NtWaitForSingleObject 000000eb4437ed90 00007ffaf9ffc97b ucrtbase!free_base+0x1b, calling ntdll!RtlFreeHeap 000000eb4437edf0 00007ffaf9ffc97b ucrtbase!free_base+0x1b, calling ntdll!RtlFreeHeap 000000eb4437ee10 00007ffabb02554c v8_x64!v8::internal::MemoryAllocator::TearDown+0x3c [c:\git\clearscript\clearscript\v8\v8\build\v8-x64\src\heap\spaces.cc:314], calling v8_x64!v8::base::Semaphore::Wait [c:\git\clearscript\clearscript\v8\v8\build\v8-x64\src\base\platform\semaphore.cc:158] 000000eb4437ee20 00007ffabae099eb v8_x64!v8::internal::StoreBuffer::TearDown+0x2b [c:\git\clearscript\clearscript\v8\v8\build\v8-x64\src\heap\store-buffer.cc:56], calling v8_x64!operator delete [f:\dd\vctools\crt\vcstartup\src\heap\delete_scalar_size.cpp:14] 000000eb4437ee50 00007ffabad9e237 v8_x64!v8::internal::Heap::TearDown+0x477 [c:\git\clearscript\clearscript\v8\v8\build\v8-x64\src\heap\heap.cc:5591], calling v8_x64!v8::internal::MemoryAllocator::TearDown [c:\git\clearscript\clearscript\v8\v8\build\v8-x64\src\heap\spaces.cc:313] 000000eb4437ee90 00007ffabad76283 v8_x64!v8::internal::Isolate::Deinit+0x193 [c:\git\clearscript\clearscript\v8\v8\build\v8-x64\src\isolate.cc:2150], calling v8_x64!v8::internal::Heap::TearDown [c:\git\clearscript\clearscript\v8\v8\build\v8-x64\src\heap\heap.cc:5474] 000000eb4437eec0 00007ffabad7b41b v8_x64!v8::internal::Isolate::TearDown+0x5b [c:\git\clearscript\clearscript\v8\v8\build\v8-x64\src\isolate.cc:2077], calling v8_x64!v8::internal::Isolate::Deinit [c:\git\clearscript\clearscript\v8\v8\build\v8-x64\src\isolate.cc:2102] 000000eb4437ef00 00007ffad0074216 ClearScriptV8_64!V8IsolateImpl::~V8IsolateImpl+0x286 [c:\git\clearscript\clearscript\v8\clearscriptv8\v8isolateimpl.cpp:656], calling v8_x64!v8::Isolate::Dispose [c:\git\clearscript\clearscript\v8\v8\build\v8-x64\src\api.cc:7473] 000000eb4437efb0 00007ffacf26886f msvcp140!__crtReleaseSRWLockExclusive+0x23 [f:\dd\vctools\crt\crtw32\misc\winapisupp.cpp:612], calling msvcp140!_guard_check_icall [f:\dd\vctools\crt\vcstartup\src\misc\checkcfg.c:61] 000000eb4437efe0 00007ffad00720e4 ClearScriptV8_64!V8IsolateImpl::`scalar deleting destructor'+0x14, calling ClearScriptV8_64!V8IsolateImpl::~V8IsolateImpl [c:\git\clearscript\clearscript\v8\clearscriptv8\v8isolateimpl.cpp:641] 000000eb4437f010 00007ffad0073e3f ClearScriptV8_64!V8IsolateImpl::CallWithLockNoWait+0x1df [c:\git\clearscript\clearscript\v8\clearscriptv8\v8isolateimpl.cpp:628] 000000eb4437f040 00007ffadf56d7ef clr!PreStubWorker+0x2e0, calling kernel32!SetLastErrorStub 000000eb4437f0c0 00007ffad00650a8 ClearScriptV8_64!V8ContextImpl::Destroy+0x68 [c:\git\clearscript\clearscript\v8\clearscriptv8\v8contextimpl.cpp:530], calling ClearScriptV8_64!V8IsolateImpl::CallWithLockNoWait [c:\git\clearscript\clearscript\v8\clearscriptv8\v8isolateimpl.cpp:613] 000000eb4437f150 00007ffa84f451fb (MethodDesc 00007ffa8518d600 +0xcb <Module>.SharedPtr<V8Context>.Release(SharedPtr<V8Context>*)) 000000eb4437f1b0 00007ffa84f451fb (MethodDesc 00007ffa8518d600 +0xcb <Module>.SharedPtr<V8Context>.Release(SharedPtr<V8Context>*)) 000000eb4437f200 00007ffa84f7121e (MethodDesc 00007ffa851c0a38 +0x4e Microsoft.ClearScript.V8.V8ContextProxyImpl.!V8ContextProxyImpl()), calling (MethodDesc 00007ffa8518d600 +0 <Module>.SharedPtr<V8Context>.Release(SharedPtr<V8Context>*)) 000000eb4437f2b0 00007ffa84f47d1e (MethodDesc 00007ffa851c0a78 +0x1e Microsoft.ClearScript.V8.V8ContextProxyImpl.Dispose(Boolean)), calling 00007ffa84f41aa8 (stub for Microsoft.ClearScript.V8.V8ContextProxyImpl.!V8ContextProxyImpl()) 000000eb4437f2f0 00007ffadf5666c6 clr!FastCallFinalizeWorker+0x6 000000eb4437f320 00007ffadf71a741 clr!ETW::GCLog::SendFinalizeObjectEvent+0xc9, calling clr!FastCallFinalizeWorker 000000eb4437f340 00007ffadf728650 clr!MethodTable::IsInitError+0x1d, calling clr!DomainLocalModule::GetClassFlags 000000eb4437f370 00007ffadf71a6c9 clr!MethodTable::CallFinalizer+0xb5, calling clr!ETW::GCLog::SendFinalizeObjectEvent+0x74 000000eb4437f3a0 00007ffadf566649 clr!CallDescrWorkerWithHandler+0x4e, calling clr!CallDescrWorkerInternal 000000eb4437f3c0 00007ffadf71a602 clr!CallFinalizer+0x5e, calling clr!MethodTable::CallFinalizer 000000eb4437f3d0 00007ffaf9c3a8d4 KERNELBASE!SetThreadLocale+0x14, calling KERNELBASE!NlsValidateLocale 000000eb4437f400 00007ffadf71a4b9 clr!FinalizerThread::DoOneFinalization+0x95, calling clr!CallFinalizer 000000eb4437f480 00007ffadf72d4ed clr!DistributeEventReliably+0x269, calling clr!_security_check_cookie 000000eb4437f4a0 00007ffadf719ce0 clr!SVR::GCHeap::GetNextFinalizableObject+0x5c, calling clr!SVR::CFinalize::IsSegEmpty 000000eb4437f4e0 00007ffadf71a3cc clr!FinalizerThread::FinalizeAllObjects+0x124, calling clr!FinalizerThread::DoOneFinalization 000000eb4437f530 00007ffadf71bc87 clr!FinalizerThread::FinalizeAllObjects_Wrapper+0x18, calling clr!FinalizerThread::FinalizeAllObjects 000000eb4437f560 00007ffadf567c9d clr!Frame::Push+0x59 000000eb4437f5a0 00007ffadf567c18 clr!MarshalInfo::SetupArgumentSizes+0x234, calling clr!Frame::Push+0x20 000000eb4437f5b0 00007ffadf72d349 clr!DistributeEventReliably+0xa9, calling clr!CLRException::HandlerState::CleanupTry 000000eb4437f600 00007ffadf56a114 clr!Thread::SetLastThrownObject+0x35, calling clr!StressLog::LogOn 000000eb4437f670 00007ffadf56737d clr!FrameWithCookie<DebuggerU2MCatchHandlerFrame>::FrameWithCookie<DebuggerU2MCatchHandlerFrame>+0x26, calling clr!Frame::Push 000000eb4437f690 00007ffadf56718c clr!SystemDomain::GetAppDomainAtId+0x40, calling clr!AppDomain::CanThreadEnter 000000eb4437f6a0 00007ffadf567b56 clr!MarshalInfo::SetupArgumentSizes+0x15d, calling clr!MarshalInfo::SetupArgumentSizes+0x1c8 000000eb4437f6b0 00007ffadf85c7b5 clr!AppDomain::RaiseUnloadDomainEvent+0x71, calling clr!CLRException::HandlerState::CleanupTry 000000eb4437f6c0 00007ffadf566051 clr!ClrFlsIncrementValue+0x29 000000eb4437f730 00007ffadf56a864 clr!Thread::ShouldChangeAbortToUnload+0x45, calling clr!MarshalInfo::SetupArgumentSizes+0xe8 000000eb4437f760 00007ffadf5b2fe9 clr!Thread::DoADCallBack+0x109 000000eb4437f790 00007ffadf653857 clr!Thread::DoADCallBack+0x27a, calling clr!Thread::ReturnToContext 000000eb4437f840 00007ffafcbc0f30 ntdll!RtlFreeHeap+0x150, calling ntdll!RtlGetCurrentServiceSessionId 000000eb4437f850 00007ffadf565ff6 clr!CrstBase::Enter+0x6a, calling ntdll!RtlTryEnterCriticalSection 000000eb4437f910 00007ffadf56a845 clr!Frame::Push+0xa2, calling clr!Thread::DoADCallBack 000000eb4437f920 00007ffadf56af62 clr!FrameWithCookie<GCFrame>::FrameWithCookie<GCFrame>+0x42, calling clr!GetThread 000000eb4437f950 00007ffadf71bc33 clr!FinalizerThread::DoOneFinalization+0x1f2, calling clr!Frame::Push+0x20 000000eb4437f9f0 00007ffadf719ce0 clr!SVR::GCHeap::GetNextFinalizableObject+0x5c, calling clr!SVR::CFinalize::IsSegEmpty 000000eb4437fa30 00007ffadf71a3cc clr!FinalizerThread::FinalizeAllObjects+0x124, calling clr!FinalizerThread::DoOneFinalization 000000eb4437fa80 00007ffadf71977b clr!FinalizerThread::FinalizerThreadWorker+0xbb, calling clr!FinalizerThread::FinalizeAllObjects 000000eb4437fa88 00007ffadf85d700 clr!GetLogicalCpuCount+0x8a, calling clr!GetLogicalCpuCountFromOS 000000eb4437fac0 00007ffadf567c9d clr!Frame::Push+0x59 000000eb4437fb00 00007ffadf567c18 clr!MarshalInfo::SetupArgumentSizes+0x234, calling clr!Frame::Push+0x20 000000eb4437fbb0 00007ffadf69bbc2 clr!Wrapper<void * __ptr64,&DoNothing<void * __ptr64>,&VoidCloseHandle,-1,&CompareDefault<void * __ptr64>,2,1>::~Wrapper<void * __ptr64,&DoNothing<void * __ptr64>,&VoidCloseHandle,-1,&CompareDefault<void * __ptr64>,2,1>+0x30, calling kernel32!CloseHandle 000000eb4437fbd0 00007ffadf56737d clr!FrameWithCookie<DebuggerU2MCatchHandlerFrame>::FrameWithCookie<DebuggerU2MCatchHandlerFrame>+0x26, calling clr!Frame::Push 000000eb4437fbf0 00007ffadf6b9d96 clr!ProfilingAPIAttachDetach::CreateAttachThread+0x76, calling clr!Wrapper<void * __ptr64,&DoNothing<void * __ptr64>,&VoidCloseHandle,-1,&CompareDefault<void * __ptr64>,2,1>::~Wrapper<void * __ptr64,&DoNothing<void * __ptr64>,&VoidCloseHandle,-1,&CompareDefault<void * __ptr64>,2,1> 000000eb4437fc00 00007ffadf567b56 clr!MarshalInfo::SetupArgumentSizes+0x15d, calling clr!MarshalInfo::SetupArgumentSizes+0x1c8 000000eb4437fc10 00007ffadf6a87d3 clr!EEConfig::GetConfigDWORD_DontUse_+0x3b, calling clr!EEConfig::GetConfiguration_DontUse_ 000000eb4437fc90 00007ffadf69f87a clr!FinalizerThread::FinalizerThreadStart+0x10a, calling clr!MarshalInfo::SetupArgumentSizes+0xe8 000000eb4437fcd0 00007ffadf566929 clr!EEHeapFreeInProcessHeap+0x45, calling kernel32!HeapFreeStub 000000eb4437fd30 00007ffadf6631cf clr!Thread::intermediateThreadProc+0x86 000000eb4437fdb0 00007ffadf6631af clr!Thread::intermediateThreadProc+0x66, calling clr!_chkstk 000000eb4437fdf0 00007ffafa102774 kernel32!BaseThreadInitThunk+0x14, calling ntdll!LdrpDispatchUserCallTarget 000000eb4437fe20 00007ffafcc00d61 ntdll!RtlUserThreadStart+0x21, calling ntdll!LdrpDispatchUserCallTarget ```

    0 0

    Hi,

    Using React.NET 3.0.1 which uses ClearScript.V8 5.4.8 following hang is observed on recycling application pool
    ```
    .NET Call Stack


    .SharedPtr.Release(SharedPtr*)+d7
    [[InlinedCallFrame] (.Decrement)] .RefCount.Decrement(RefCount*)
    Microsoft.ClearScript.V8.V8ContextProxyImpl.!V8ContextProxyImpl()+4e
    Microsoft.ClearScript.V8.V8ContextProxyImpl.Dispose(Boolean)+1f
    [[DebuggerU2MCatchHandlerFrame]]
    [[ContextTransitionFrame]]
    [[GCFrame]]
    [[DebuggerU2MCatchHandlerFrame]]

    Full Call Stack

    ntdll!NtWaitForSingleObject+14
    KERNELBASE!WaitForSingleObjectEx+8f
    v8_x64!v8::Extension::dependencies+329ac
    v8_x64!v8::ExternalResourceVisitor::VisitExternalString+28187
    v8_x64!v8::ExternalResourceVisitor::VisitExternalString+1a3
    v8_x64!v8::ExternalResourceVisitor::VisitExternalString+533b
    ClearScriptV8_64+14216
    ClearScriptV8_64+120e4
    ClearScriptV8_64+13e3f
    ClearScriptV8_64+50a8
    <Module>.SharedPtr<V8Context>.Release(SharedPtr<V8Context>*)+d7
    [[InlinedCallFrame] (<Module>.Decrement)] <Module>.RefCount.Decrement(RefCount*)
    Microsoft.ClearScript.V8.V8ContextProxyImpl.!V8ContextProxyImpl()+4e
    Microsoft.ClearScript.V8.V8ContextProxyImpl.Dispose(Boolean)+1f
    clr!FastCallFinalizeWorker+6
    clr!ETW::GCLog::SendFinalizeObjectEvent+c9
    clr!MethodTable::CallFinalizer+b5
    clr!CallFinalizer+5e
    clr!FinalizerThread::DoOneFinalization+95
    clr!FinalizerThread::FinalizeAllObjects+133
    clr!FinalizerThread::FinalizeAllObjects_Wrapper+18
    clr!Frame::Push+59
    clr!PEDecoder::GetNativeCodeManagerTable+170
    clr!PEDecoder::GetNativeCodeManagerTable+99
    [[DebuggerU2MCatchHandlerFrame]]
    clr!Thread::ShouldChangeAbortToUnload+45
    clr!Thread::DoADCallBack+109
    [[ContextTransitionFrame]]
    clr!Frame::Push+a2
    clr!FinalizerThread::DoOneFinalization+1f9
    [[GCFrame]]
    clr!FinalizerThread::FinalizeAllObjects+133
    clr!FinalizerThread::FinalizerThreadWorker+bb
    clr!Frame::Push+59
    clr!PEDecoder::GetNativeCodeManagerTable+170
    clr!PEDecoder::GetNativeCodeManagerTable+99
    [[DebuggerU2MCatchHandlerFrame]]
    clr!FinalizerThread::FinalizerThreadStart+10a
    clr!Thread::intermediateThreadProc+86
    kernel32!BaseThreadInitThunk+14
    ntdll!RtlUserThreadStart+21
    ```
    Comments: Thanks again. A question: Does the hang block the recycling of the application pool indefinitely, or does the system eventually detect it and terminate the process?

    0 0

    Hi,

    Using React.NET 3.0.1 which uses ClearScript.V8 5.4.8 following hang is observed on recycling application pool
    ```
    .NET Call Stack


    .SharedPtr.Release(SharedPtr*)+d7
    [[InlinedCallFrame] (.Decrement)] .RefCount.Decrement(RefCount*)
    Microsoft.ClearScript.V8.V8ContextProxyImpl.!V8ContextProxyImpl()+4e
    Microsoft.ClearScript.V8.V8ContextProxyImpl.Dispose(Boolean)+1f
    [[DebuggerU2MCatchHandlerFrame]]
    [[ContextTransitionFrame]]
    [[GCFrame]]
    [[DebuggerU2MCatchHandlerFrame]]

    Full Call Stack

    ntdll!NtWaitForSingleObject+14
    KERNELBASE!WaitForSingleObjectEx+8f
    v8_x64!v8::Extension::dependencies+329ac
    v8_x64!v8::ExternalResourceVisitor::VisitExternalString+28187
    v8_x64!v8::ExternalResourceVisitor::VisitExternalString+1a3
    v8_x64!v8::ExternalResourceVisitor::VisitExternalString+533b
    ClearScriptV8_64+14216
    ClearScriptV8_64+120e4
    ClearScriptV8_64+13e3f
    ClearScriptV8_64+50a8
    <Module>.SharedPtr<V8Context>.Release(SharedPtr<V8Context>*)+d7
    [[InlinedCallFrame] (<Module>.Decrement)] <Module>.RefCount.Decrement(RefCount*)
    Microsoft.ClearScript.V8.V8ContextProxyImpl.!V8ContextProxyImpl()+4e
    Microsoft.ClearScript.V8.V8ContextProxyImpl.Dispose(Boolean)+1f
    clr!FastCallFinalizeWorker+6
    clr!ETW::GCLog::SendFinalizeObjectEvent+c9
    clr!MethodTable::CallFinalizer+b5
    clr!CallFinalizer+5e
    clr!FinalizerThread::DoOneFinalization+95
    clr!FinalizerThread::FinalizeAllObjects+133
    clr!FinalizerThread::FinalizeAllObjects_Wrapper+18
    clr!Frame::Push+59
    clr!PEDecoder::GetNativeCodeManagerTable+170
    clr!PEDecoder::GetNativeCodeManagerTable+99
    [[DebuggerU2MCatchHandlerFrame]]
    clr!Thread::ShouldChangeAbortToUnload+45
    clr!Thread::DoADCallBack+109
    [[ContextTransitionFrame]]
    clr!Frame::Push+a2
    clr!FinalizerThread::DoOneFinalization+1f9
    [[GCFrame]]
    clr!FinalizerThread::FinalizeAllObjects+133
    clr!FinalizerThread::FinalizerThreadWorker+bb
    clr!Frame::Push+59
    clr!PEDecoder::GetNativeCodeManagerTable+170
    clr!PEDecoder::GetNativeCodeManagerTable+99
    [[DebuggerU2MCatchHandlerFrame]]
    clr!FinalizerThread::FinalizerThreadStart+10a
    clr!Thread::intermediateThreadProc+86
    kernel32!BaseThreadInitThunk+14
    ntdll!RtlUserThreadStart+21
    ```
    Comments: It seems indefinitely to me. Last time it was hanging for about an hour before I've killed w3wp process.

    0 0

    Hi,

    Using React.NET 3.0.1 which uses ClearScript.V8 5.4.8 following hang is observed on recycling application pool
    ```
    .NET Call Stack


    .SharedPtr.Release(SharedPtr*)+d7
    [[InlinedCallFrame] (.Decrement)] .RefCount.Decrement(RefCount*)
    Microsoft.ClearScript.V8.V8ContextProxyImpl.!V8ContextProxyImpl()+4e
    Microsoft.ClearScript.V8.V8ContextProxyImpl.Dispose(Boolean)+1f
    [[DebuggerU2MCatchHandlerFrame]]
    [[ContextTransitionFrame]]
    [[GCFrame]]
    [[DebuggerU2MCatchHandlerFrame]]

    Full Call Stack

    ntdll!NtWaitForSingleObject+14
    KERNELBASE!WaitForSingleObjectEx+8f
    v8_x64!v8::Extension::dependencies+329ac
    v8_x64!v8::ExternalResourceVisitor::VisitExternalString+28187
    v8_x64!v8::ExternalResourceVisitor::VisitExternalString+1a3
    v8_x64!v8::ExternalResourceVisitor::VisitExternalString+533b
    ClearScriptV8_64+14216
    ClearScriptV8_64+120e4
    ClearScriptV8_64+13e3f
    ClearScriptV8_64+50a8
    <Module>.SharedPtr<V8Context>.Release(SharedPtr<V8Context>*)+d7
    [[InlinedCallFrame] (<Module>.Decrement)] <Module>.RefCount.Decrement(RefCount*)
    Microsoft.ClearScript.V8.V8ContextProxyImpl.!V8ContextProxyImpl()+4e
    Microsoft.ClearScript.V8.V8ContextProxyImpl.Dispose(Boolean)+1f
    clr!FastCallFinalizeWorker+6
    clr!ETW::GCLog::SendFinalizeObjectEvent+c9
    clr!MethodTable::CallFinalizer+b5
    clr!CallFinalizer+5e
    clr!FinalizerThread::DoOneFinalization+95
    clr!FinalizerThread::FinalizeAllObjects+133
    clr!FinalizerThread::FinalizeAllObjects_Wrapper+18
    clr!Frame::Push+59
    clr!PEDecoder::GetNativeCodeManagerTable+170
    clr!PEDecoder::GetNativeCodeManagerTable+99
    [[DebuggerU2MCatchHandlerFrame]]
    clr!Thread::ShouldChangeAbortToUnload+45
    clr!Thread::DoADCallBack+109
    [[ContextTransitionFrame]]
    clr!Frame::Push+a2
    clr!FinalizerThread::DoOneFinalization+1f9
    [[GCFrame]]
    clr!FinalizerThread::FinalizeAllObjects+133
    clr!FinalizerThread::FinalizerThreadWorker+bb
    clr!Frame::Push+59
    clr!PEDecoder::GetNativeCodeManagerTable+170
    clr!PEDecoder::GetNativeCodeManagerTable+99
    [[DebuggerU2MCatchHandlerFrame]]
    clr!FinalizerThread::FinalizerThreadStart+10a
    clr!Thread::intermediateThreadProc+86
    kernel32!BaseThreadInitThunk+14
    ntdll!RtlUserThreadStart+21
    ```
    Comments: Thanks! Last question (hopefully): Did you have to build anything else locally (e.g., JavaScriptEngineSwitcher, ReactJS.NET, etc.) in order to deploy your private version of ClearScript?

    0 0

    Hi,

    Using React.NET 3.0.1 which uses ClearScript.V8 5.4.8 following hang is observed on recycling application pool
    ```
    .NET Call Stack


    .SharedPtr.Release(SharedPtr*)+d7
    [[InlinedCallFrame] (.Decrement)] .RefCount.Decrement(RefCount*)
    Microsoft.ClearScript.V8.V8ContextProxyImpl.!V8ContextProxyImpl()+4e
    Microsoft.ClearScript.V8.V8ContextProxyImpl.Dispose(Boolean)+1f
    [[DebuggerU2MCatchHandlerFrame]]
    [[ContextTransitionFrame]]
    [[GCFrame]]
    [[DebuggerU2MCatchHandlerFrame]]

    Full Call Stack

    ntdll!NtWaitForSingleObject+14
    KERNELBASE!WaitForSingleObjectEx+8f
    v8_x64!v8::Extension::dependencies+329ac
    v8_x64!v8::ExternalResourceVisitor::VisitExternalString+28187
    v8_x64!v8::ExternalResourceVisitor::VisitExternalString+1a3
    v8_x64!v8::ExternalResourceVisitor::VisitExternalString+533b
    ClearScriptV8_64+14216
    ClearScriptV8_64+120e4
    ClearScriptV8_64+13e3f
    ClearScriptV8_64+50a8
    <Module>.SharedPtr<V8Context>.Release(SharedPtr<V8Context>*)+d7
    [[InlinedCallFrame] (<Module>.Decrement)] <Module>.RefCount.Decrement(RefCount*)
    Microsoft.ClearScript.V8.V8ContextProxyImpl.!V8ContextProxyImpl()+4e
    Microsoft.ClearScript.V8.V8ContextProxyImpl.Dispose(Boolean)+1f
    clr!FastCallFinalizeWorker+6
    clr!ETW::GCLog::SendFinalizeObjectEvent+c9
    clr!MethodTable::CallFinalizer+b5
    clr!CallFinalizer+5e
    clr!FinalizerThread::DoOneFinalization+95
    clr!FinalizerThread::FinalizeAllObjects+133
    clr!FinalizerThread::FinalizeAllObjects_Wrapper+18
    clr!Frame::Push+59
    clr!PEDecoder::GetNativeCodeManagerTable+170
    clr!PEDecoder::GetNativeCodeManagerTable+99
    [[DebuggerU2MCatchHandlerFrame]]
    clr!Thread::ShouldChangeAbortToUnload+45
    clr!Thread::DoADCallBack+109
    [[ContextTransitionFrame]]
    clr!Frame::Push+a2
    clr!FinalizerThread::DoOneFinalization+1f9
    [[GCFrame]]
    clr!FinalizerThread::FinalizeAllObjects+133
    clr!FinalizerThread::FinalizerThreadWorker+bb
    clr!Frame::Push+59
    clr!PEDecoder::GetNativeCodeManagerTable+170
    clr!PEDecoder::GetNativeCodeManagerTable+99
    [[DebuggerU2MCatchHandlerFrame]]
    clr!FinalizerThread::FinalizerThreadStart+10a
    clr!Thread::intermediateThreadProc+86
    kernel32!BaseThreadInitThunk+14
    ntdll!RtlUserThreadStart+21
    ```
    Comments: Yes, I had to build JavaScriptEngineSwitcher locally to be able to use private version of ClearScript.

    0 0

    I am trying to run my application in a docker container, but it crashes with the following error:

    ```
    Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
    at std._Func_class<void>.()(_Func_class<void>* )
    at Microsoft.ClearScript.V8.NativeCallbackImpl.Invoke()
    at Microsoft.ClearScript.Util.MiscHelpers.Try(Action action)
    at Microsoft.ClearScript.Util.NativeCallbackTimer.OnTimer(Object state)
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
    at System.Threading.TimerQueueTimer.CallCallback()
    at System.Threading.TimerQueueTimer.Fire()
    at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
    at System.Threading.ThreadPoolWorkQueue.Dispatch()
    ```

    0 0

    I am trying to run my application in a docker container, but it crashes with the following error:

    ```
    Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
    at std._Func_class<void>.()(_Func_class<void>* )
    at Microsoft.ClearScript.V8.NativeCallbackImpl.Invoke()
    at Microsoft.ClearScript.Util.MiscHelpers.Try(Action action)
    at Microsoft.ClearScript.Util.NativeCallbackTimer.OnTimer(Object state)
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
    at System.Threading.TimerQueueTimer.CallCallback()
    at System.Threading.TimerQueueTimer.Fire()
    at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
    at System.Threading.ThreadPoolWorkQueue.Dispatch()
    ```

    There are a lot of script code in the application, so it is difficult to find the specific lines of code that causes the crash. Does anyone have any ideas what could cause that or advice how to debug this issue?

    0 0

    I am trying to run my application in a docker container, but it crashes with the following error:

    ```
    Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
    at std._Func_class<void>.()(_Func_class<void>* )
    at Microsoft.ClearScript.V8.NativeCallbackImpl.Invoke()
    at Microsoft.ClearScript.Util.MiscHelpers.Try(Action action)
    at Microsoft.ClearScript.Util.NativeCallbackTimer.OnTimer(Object state)
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
    at System.Threading.TimerQueueTimer.CallCallback()
    at System.Threading.TimerQueueTimer.Fire()
    at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
    at System.Threading.ThreadPoolWorkQueue.Dispatch()
    ```

    another exception

    ```
    Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
    at V8Context.Create(SharedPtr<V8Isolate>* , StdString* , Boolean , Boolean , Int32 )
    at Microsoft.ClearScript.V8.V8ContextProxyImpl..ctor(V8IsolateProxy gcIsolateProxy, String gcName, Boolean enableDebugging, Boolean disableGlobalMembers, Int32 debugPort)
    --- End of inner exception stack trace ---
    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
    at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
    at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
    at System.Activator.CreateInstance(Type type, Object[] args)
    at Microsoft.ClearScript.V8.V8Proxy.CreateImpl[T](Object[] args)
    at Microsoft.ClearScript.V8.V8ScriptEngine..ctor(V8Runtime runtime, String name, V8RuntimeConstraints constraints, V8ScriptEngineFlags flags, Int32 debugPort)
    at JavaScriptEngineSwitcher.V8.V8JsEngine..ctor(V8Settings settings)
    at JavaScriptEngineSwitcher.V8.V8JsEngineFactory.CreateEngine()
    at React.JavaScriptEngineFactory.GetFactory(JsEngineSwitcher jsEngineSwitcher, Boolean allowMsie)
    at React.JavaScriptEngineFactory..ctor(JsEngineSwitcher jsEngineSwitcher, IReactSiteConfiguration config, IFileSystem fileSystem)
    at lambda_method(Closure , Object[] )
    at React.TinyIoC.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options)
    at React.TinyIoC.TinyIoCContainer.SingletonFactory.GetObject(Type requestedType, TinyIoCContainer container, NamedParameterOverloads parameters, ResolveOptions options)
    at React.TinyIoC.TinyIoCContainer.ResolveInternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options)
    at React.TinyIoC.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options)
    at React.TinyIoC.TinyIoCContainer.CustomObjectLifetimeFactory.GetObject(Type requestedType, TinyIoCContainer container, NamedParameterOverloads parameters, ResolveOptions options)
    at React.TinyIoC.TinyIoCContainer.ResolveInternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options)
    at React.TinyIoC.TinyIoCContainer.Resolve[ResolveType]()
    at React.AspNet.HtmlHelperExtensions.get_Environment()
    at React.AspNet.HtmlHelperExtensions.React[T](IHtmlHelper htmlHelper, String componentName, T props, String htmlTag, String containerId, Boolean clientOnly, Boolean serverOnly, String containerClass)
    at AspNetCore._Views_Site_Menu_cshtml.<ExecuteAsync>d__33.MoveNext() in /Views/Site/Menu.cshtml:line 3
    at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
    at AspNetCore._Views_Site_Menu_cshtml.ExecuteAsync()
    ```

    There are a lot of script code in the application, so it is difficult to find the specific lines of code that causes the crash. Does anyone have any ideas what could cause that or advice how to debug this issue?

    0 0

    I am trying to run my application in a docker container, but it crashes with the following error:

    ```
    Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
    at std._Func_class<void>.()(_Func_class<void>* )
    at Microsoft.ClearScript.V8.NativeCallbackImpl.Invoke()
    at Microsoft.ClearScript.Util.MiscHelpers.Try(Action action)
    at Microsoft.ClearScript.Util.NativeCallbackTimer.OnTimer(Object state)
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
    at System.Threading.TimerQueueTimer.CallCallback()
    at System.Threading.TimerQueueTimer.Fire()
    at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
    at System.Threading.ThreadPoolWorkQueue.Dispatch()
    ```

    another exception

    ```
    Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
    at V8Context.Create(SharedPtr<V8Isolate>* , StdString* , Boolean , Boolean , Int32 )
    at Microsoft.ClearScript.V8.V8ContextProxyImpl..ctor(V8IsolateProxy gcIsolateProxy, String gcName, Boolean enableDebugging, Boolean disableGlobalMembers, Int32 debugPort)
    --- End of inner exception stack trace ---
    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
    at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
    at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
    at System.Activator.CreateInstance(Type type, Object[] args)
    at Microsoft.ClearScript.V8.V8Proxy.CreateImpl[T](Object[] args)
    at Microsoft.ClearScript.V8.V8ScriptEngine..ctor(V8Runtime runtime, String name, V8RuntimeConstraints constraints, V8ScriptEngineFlags flags, Int32 debugPort)
    at JavaScriptEngineSwitcher.V8.V8JsEngine..ctor(V8Settings settings)
    at JavaScriptEngineSwitcher.V8.V8JsEngineFactory.CreateEngine()
    at React.JavaScriptEngineFactory.GetFactory(JsEngineSwitcher jsEngineSwitcher, Boolean allowMsie)
    at React.JavaScriptEngineFactory..ctor(JsEngineSwitcher jsEngineSwitcher, IReactSiteConfiguration config, IFileSystem fileSystem)
    at lambda_method(Closure , Object[] )
    at React.TinyIoC.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options)
    at React.TinyIoC.TinyIoCContainer.SingletonFactory.GetObject(Type requestedType, TinyIoCContainer container, NamedParameterOverloads parameters, ResolveOptions options)
    at React.TinyIoC.TinyIoCContainer.ResolveInternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options)
    at React.TinyIoC.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options)
    at React.TinyIoC.TinyIoCContainer.CustomObjectLifetimeFactory.GetObject(Type requestedType, TinyIoCContainer container, NamedParameterOverloads parameters, ResolveOptions options)
    at React.TinyIoC.TinyIoCContainer.ResolveInternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options)
    at React.TinyIoC.TinyIoCContainer.Resolve[ResolveType]()
    at React.AspNet.HtmlHelperExtensions.get_Environment()
    at React.AspNet.HtmlHelperExtensions.React[T](IHtmlHelper htmlHelper, String componentName, T props, String htmlTag, String containerId, Boolean clientOnly, Boolean serverOnly, String containerClass)
    at AspNetCore._Views_Site_Menu_cshtml.<ExecuteAsync>d__33.MoveNext() in /Views/Site/Menu.cshtml:line 3
    at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
    at AspNetCore._Views_Site_Menu_cshtml.ExecuteAsync()
    ```

    There are a lot of script code in the application, so it is difficult to find the specific lines of code that causes the crash. Does anyone have any ideas what could cause that or advice how to debug this issue?
    Comments: Hello! These stacks (especially the second one) almost always indicate out-of-memory conditions, which V8 handles by crashing immediately via unrecoverable access violation. Ignoring the possibility of runaway script code, this can happen if you create a large number of V8 runtimes in a 32-bit process. Each V8 runtime reserves a large block of address space at startup, and in a 32-bit process you can run out of address space with just a few dozen instances. Another possibility is that the V8 runtime is too constrained to complete startup. Are you using `V8RuntimeConstraints` to specify memory usage limits? Also, could it be that Docker is imposing various limits on your application? Thanks!

older | 1 | .... | 112 | 113 | (Page 114) | 115 | newer