cefsharp / CefSharp

.NET (WPF and Windows Forms) bindings for the Chromium Embedded Framework
http://cefsharp.github.io/
Other
9.88k stars 2.92k forks source link

Version mismatch between CefSharp and Microsoft Edge WebView2 Runtime #4946

Closed maaz-astera closed 1 month ago

maaz-astera commented 1 month ago

Is there an existing issue for this?

CefSharp Version

128.4.90

Operating System

Windows 10

Architecture

x64

.Net Version

.Net 8

Implementation

WPF

Reproduction Steps

I've added my project references like this:

<PackageReference Include="CefSharp.Wpf.NETCore" Version="128.4.90" />
    <PackageReference Include="chromiumembeddedframework.runtime" Version="128.4.90" />
    <PackageReference Include="chromiumembeddedframework.runtime.win-arm64" Version="128.4.90" />
    <PackageReference Include="chromiumembeddedframework.runtime.win-x64" Version="128.4.90" />
    <PackageReference Include="chromiumembeddedframework.runtime.win-x86" Version="128.4.90" />

My code to initialize CefSharp:

private static void LoadBrowserApp()
    {
        var settings = new CefSettings()
        {
            //@noloc
            CachePath = FilePath.Combine(AsteraAppContext.Paths.SystemFilePath, @"CefSharp\Cache"),
            LogSeverity = LogSeverity.Verbose,
            LogFile = FilePath.Combine(AsteraAppContext.Paths.SystemFilePath, "cefsharp.log")
        };
        //@noloc
        settings.CefCommandLineArgs.Add("enable-media-stream");
        //@noloc
        settings.CefCommandLineArgs.Add("disable-gpu", "1");
        //@noloc
        settings.CefCommandLineArgs.Add("disable-gpu-vsync", "1");
        //@noloc
        settings.CefCommandLineArgs.Add("disable-gpu-compositing", "1");
        CefSharpSettings.ShutdownOnExit = true;
        CefSharpSettings.SubprocessExitIfParentProcessClosed = true;
        if (Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null))
        {
            BrowserControlWPF.CefSharpSupport = true;
        }
        else
        {
            InfoBoxWPF.ShowError("CefSharp Browser failed to initialize.");
            BrowserControlWPF.CefSharpSupport = false;
        }
    }

Expected behavior

CefSharp is supposed to initialize fine with no errors.

Actual behavior

Running the project gives me CefSharp Browser failed to initialize error.

Regression?

No response

Known Workarounds

Having been facing the issue for quite a while. I keep updating the CefSharp library version and it'd work fine but only for a few weeks. Now, it's in latest version and still facing this issue.

Does this problem also occur in the CEF Sample Application

Yes using WPF/OffScreen command line args

Other information

I've read a while ago that if there is a version mismatch between CefSharp and Microsoft Edge Webview2, it'd create issues. Currently, the CefSharp version is 128.4.90 and WebView2 version is 129.0 Is there any way to fix this issue without keep updating my CefSharp version?