System.Exception: "IBrowserHost instance is null. Browser has likely not finished initializing or is in the process of disposing." #4031
Replies: 5 comments 7 replies
-
In future please use discussions to ask questions. This is not a bug. https://github.com/cefsharp/CefSharp/discussions
In your case the browser hasn't been initialized yet. Wait for the browser to initialize before attempting to access the cookie manager. |
Beta Was this translation helpful? Give feedback.
-
Getting similar results. I second this issue nomination. Maybe we are doing something funny discussion worthy, but so far, looking like a bug. Happy to be incorrect in that. CEF is definitely claiming Initialized, however, the BrowserCore is definitely when that is raised, As far as usage, I am starting from the minimal WPF example use case. So far I am creating the window with the CEF instance embedded, however, I am leaving it <Border BorderBrush="Gray" BorderThickness="0,1">
<wpf:ChromiumWebBrowser x:Name="Browser" Address="..." Initialized="Wrapper_Browser_Initialized" />
</Border> private void Wrapper_Browser_Initialized(object sender, EventArgs e)
{
// sender is ChromiumWebBrowser, which BrowserCore is definitely null at the moment this is raised.
} Under debugging watch: |
Beta Was this translation helpful? Give feedback.
-
For Pete's sake, VICTORY! 🎆 🔥 |
Beta Was this translation helpful? Give feedback.
-
For the issue itself, ensuring that the host Window is visible and has loaded fully, is the key for the Browser instance to also have been initialized and DOM available. Once that was the case, sorted out my Chrome selector query strings, which were also problematic. Once I got those sorted out, the rest flowed like magic seamlessly with the browser window. |
Beta Was this translation helpful? Give feedback.
-
The WinForms and WPF implementations both have an
The code provided by the In The
The There's examples of waiting for the browser to initialize in https://github.com/cefsharp/CefSharp/wiki/General-Usage#devtools
The Anyone can edit the |
Beta Was this translation helpful? Give feedback.
-
Hello, i have a problem with adding cookies in Cookie Mananger. When i try to set cookie, i get System.Exception: "IBrowserHost instance is null. Browser has likely not finished initializing or is in the process of disposing."
The script works without errors when using Cef.GetGlobalCookieManager(), but I need to set the cookie to this particular browser instance
Beta Was this translation helpful? Give feedback.
All reactions