diff --git a/CefSharp.OffScreen/ChromiumWebBrowser.cs b/CefSharp.OffScreen/ChromiumWebBrowser.cs index 5fa4660b0..ea69a0609 100644 --- a/CefSharp.OffScreen/ChromiumWebBrowser.cs +++ b/CefSharp.OffScreen/ChromiumWebBrowser.cs @@ -44,6 +44,11 @@ namespace CefSharp.OffScreen /// The browser settings to use. If null, the default settings are used. public ChromiumWebBrowser(string address, BrowserSettings browserSettings = null) { + if (!Cef.IsInitialized && !Cef.Initialize()) + { + throw new InvalidOperationException("Cef::Initialize() failed"); + } + ResourceHandler = new DefaultResourceHandler(); Cef.AddDisposable(this); diff --git a/CefSharp.WinForms/ChromiumWebBrowser.cs b/CefSharp.WinForms/ChromiumWebBrowser.cs index bae76d602..55f0f0b8c 100644 --- a/CefSharp.WinForms/ChromiumWebBrowser.cs +++ b/CefSharp.WinForms/ChromiumWebBrowser.cs @@ -56,6 +56,11 @@ namespace CefSharp.WinForms public ChromiumWebBrowser(string address) { + if (!Cef.IsInitialized && !Cef.Initialize()) + { + throw new InvalidOperationException("Cef::Initialize() failed"); + } + Cef.AddDisposable(this); Address = address;