Resolved: CefSharp LoadUrl when browser not initialized


I came across other CefSharp related thread where it was stated that LoadUrl() will fail if ChromiumWebBrowser wasn’t yet initialized. However in my code, I call LoadUrl immediately after having created ChromiumWebBrowser instance and it works perfectly fine.
var browser = new ChromiumWebBrowser();
control.Content = browser;
Please note I instantiate the class without address parameter.
I was thinking that maybe I should handle IsBrowserInitializedChanged event and LoadUrl there instead, but this seems to be working. What is the right approach?


Starting in version 95 it is no longer required to wait for the browser to initialize.
Calling LoadUrl immediately after instantiating a ChromiumWebBrowser instance in WPF will internally set the initial address which as the name implies is the url initially loaded in the browser.
So your code is fine as is.

If you have better answer, please add a comment about this, thank you!