0

I am using cefsharp 87.1.132. My program has the ability to clear the browser cache. After closing the browser, several BrowserSubprocess processes remain that block the cache files and prevent them from being deleted. Before updating from version 71.0.2, everything worked correctly and after closing the browser, all BrowserSubprocess processes were closed. I can't figure out how to fix this problem, maybe there is a way to fix it, or at least make it possible to delete the cache without restarting the program. My Cef initialization method:

public static void Init(Settings appsettings)
{
    CefSettings cefSettings = new CefSettings()
    {
        LocalesDirPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "locales"),
        Locale = appsettings.CurrentChromeLanguage.ToLocal(),
        UserAgent = appsettings.UserAgent,
        AcceptLanguageList = appsettings.CurrentChromeLanguage.ToAcceptList()
    };
    if (!appsettings.IsAnimation)
    {
        cefSettings.SetOffScreenRenderingBestPerformanceArgs();
        cefSettings.WindowlessRenderingEnabled = false;
    }
    else
    {
        cefSettings.WindowlessRenderingEnabled = true;
    }
    if (!cefSettings.CefCommandLineArgs.ContainsKey("disable-gpu"))
    {
        cefSettings.CefCommandLineArgs.Add("disable-gpu", "1");
    }
    if (cefSettings.CefCommandLineArgs.ContainsKey("enable-system-flash"))
    {
        cefSettings.CefCommandLineArgs.Remove("enable-system-flash");
    }
    if (cefSettings.CefCommandLineArgs.ContainsKey("enable-media-stream"))
    {
        cefSettings.CefCommandLineArgs.Remove("enable-media-stream");
    }
    cefSettings.CefCommandLineArgs.Add("enable-media-stream", "0");
    if (!appsettings.IsLoadImage)
    {
        cefSettings.CefCommandLineArgs.Add("disable-image-loading", "1");
    }
    cefSettings.LogFile = Path.Combine(ClientConfig.ChromeDataPath, "Log.txt");
    cefSettings.LogSeverity = LogSeverity.Error;
    cefSettings.IgnoreCertificateErrors = true;
    if (!Cef.IsInitialized && !Cef.Initialize(cefSettings))
    {
        throw new ArgumentException("Chrome не инициализирован");
    }
}
  • Firstly this is the expected behaviour, there are processes for GPU, network, audio, etc You can use the DevTools protocol to delete disk cache, local storage, etc. https://github.com/cefsharp/CefSharp/issues/3165 https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-clearBrowserCache http://cefsharp.github.io/api/89.0.x/html/M_CefSharp_DevTools_Network_NetworkClient_ClearBrowserCacheAsync.htm – amaitland Apr 17 '21 at 03:37
  • Also IgnoreCertificateErrors no longer works, see https://stackoverflow.com/questions/35555754/how-to-bypass-ssl-error-cefsharp-winforms/35564187#35564187 for alternatives – amaitland Apr 17 '21 at 03:45

0 Answers0