我现在已经运行了十份程序。四个被冻结。请解释为什么不调用Cef初始化
private static ChromiumWebBrowser _browser;
public static void InitializeBrowser()
{
Console.WriteLine("InitializeBrowser() -> start");
if (Cef.IsInitialized)
Console.WriteLine("InitializeBrowser() -> IsInitialized");
Cef.Initialize(new CefSettings(), performDependencyCheck: true, browserProcessHandler: null);
_browser = new ChromiumWebBrowser();
AutoResetEvent waitHandleOnBrowserInitialized = new AutoResetEvent(false);
EventHandler onBrowserInitialized = null;
onBrowserInitialized = async (sender, e) =>
{
_browser.BrowserInitialized -= onBrowserInitialized;
Console.WriteLine("InitializeBrowser() -> -=onBrowserInitialized");
waitHandleOnBrowserInitialized.Set();
};
_browser.BrowserInitialized += onBrowserInitialized;
Console.WriteLine("InitializeBrowser() -> +=onBrowserInitialized");
waitHandleOnBrowserInitialized.WaitOne();
Console.WriteLine("InitializeBrowser() -> finish");
}
初始化过程冻结