{"record":{"id":"470846714df1d04b","repo":"cefsharp/CefSharp","slug":"chromiumwebbrowser","errorCode":null,"errorMessage":"ChromiumWebBrowser","messagePattern":"ChromiumWebBrowser","errorType":"exception","errorClass":"ObjectDisposedException","httpStatus":null,"severity":"error","filePath":"CefSharp/Internals/Partial/ChromiumWebBrowser.Partial.cs","lineNumber":567,"sourceCode":"        /// </summary>\n        /// <exception cref=\"Exception\">Thrown when an exception error condition occurs.</exception>\n        private void ThrowExceptionIfBrowserNotInitialized()\n        {\n            if (!InternalIsBrowserInitialized())\n            {\n                throw new Exception(BrowserNotInitializedExceptionErrorMessage);\n            }\n        }\n\n        /// <summary>\n        /// Throw exception if disposed.\n        /// </summary>\n        /// <exception cref=\"ObjectDisposedException\">Thrown when a supplied object has been disposed.</exception>\n        private void ThrowExceptionIfDisposed()\n        {\n            if (IsDisposed)\n            {\n                throw new ObjectDisposedException(\"ChromiumWebBrowser\");\n            }\n        }\n\n        private int GetChromiumChildProcessId(string frameIdentifier)\n        {\n            try\n            {\n                var parts = frameIdentifier.Split('-');\n\n                if (int.TryParse(parts[0], out var childProcessId))\n                    return childProcessId;\n            }\n            catch\n            {\n\n            }\n\n            return -1;","sourceCodeStart":549,"sourceCodeEnd":585,"githubUrl":"https://github.com/cefsharp/CefSharp/blob/16bc6e0711a4945be17e8bc4bc7ccf9469f3fdec/CefSharp/Internals/Partial/ChromiumWebBrowser.Partial.cs#L549-L585","documentation":"Thrown by ThrowExceptionIfDisposed as a standard ObjectDisposedException when the ChromiumWebBrowser has already been disposed (IsDisposed is true). The 'ChromiumWebBrowser' string is the object name passed to ObjectDisposedException. Any member guarded by ThrowExceptionIfDisposed will raise this after Dispose().","triggerScenarios":"Calling a method/property on the browser after Dispose() has run; using a browser held by a using-block or disposed parent; racing with disposal in an async callback.","commonSituations":"DI container disposing the browser while a callback still references it; window close disposing the control and a late event handler firing; OffScreen browser used after explicit dispose.","solutions":["Check IsDisposed before using the browser in callbacks.","Stop/await outstanding async operations before disposing.","Remove event handlers before disposal to avoid late invocations.","Scope references so nothing outlives the browser lifecycle."],"exampleFix":"// before\nbrowser.Load(url); // may run after Dispose in a callback\n\n// after\nif (!browser.IsDisposed)\n{\n    browser.Load(url);\n}","handlingStrategy":"type-guard","validationCode":"if (!browser.IsDisposed) { browser.Load(url); }","typeGuard":"static bool IsUsable(ChromiumWebBrowser b) => b != null && !b.IsDisposed;","tryCatchPattern":"try { browser.Load(url); }\ncatch (ObjectDisposedException) { /* browser already disposed; ignore or recreate */ }","preventionTips":["Check IsDisposed before invoking members from callbacks.","Detach event handlers before disposing.","Await outstanding async operations before Dispose."],"tags":["cefsharp","disposal","objectdisposed","lifecycle"],"backgroundTag":null,"analyzedSha":"16bc6e0711a4945be17e8bc4bc7ccf9469f3fdec","analyzedAt":"2026-08-13T19:57:05.828Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}