最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

cefsharp - Exception: Cef.IsInitialized was false!.Check the log file for errors!. - On around 1 out of 20 startups of the same

programmeradmin2浏览0评论

On around 1 of 20 startups of the C# WPF application and opening a window with CefSharp Control on it, I get the exception:

Cef.IsInitialized was false!.Check the log file for errors!. See for details.

Stacktrace: CefSharp.Wpf.ChromiumWebBrowser.InitializeCefInternal() CefSharp.Wpf.ChromiumWebBrowser.NoInliningConstructor()
CefSharp.Wpf.ChromiumWebBrowser..ctor()

Logfile does not state any errors.

I use the following code at startup:

    public static void InitCef() {
        try {
            var cefLogFileName = Logger.GetLogFileName() + ".cef";
            var settings = new CefSettings() {
                LogFile = cefLogFileName, //You can customise this path
                LogSeverity = LogSeverity.Info // You can change the log level
            };

            //Perform dependency check to make sure all relevant resources are in our output directory.
            Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);

        } catch (Exception ex) {
            _logger.LogError(MethodBase.GetCurrentMethod(), ex, () => "Startup abgebrochen.");
        }
    }

After this code was running successfull the user can open a Window with CefSharp on it. => The above exceptions occurs sometimes.

Workaround is: Restart of the application. After a restart - most of the times - it is working.

CefSharp Version in use: 130.1.90

Any hints?

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论