public void Dispose() { if (!isDisposing && !v8.IsDisposed) { isDisposing = true; ExecuteGlobalScriptFunction("shutdown"); // SHUTDOWN all scripts GC.WaitForPendingFinalizers(); GC.Collect(); v8.ForceV8GarbageCollection(); v8.Dispose(); // Notify engine that we have terminated OnShutdown(); } }