C# WPF with CefSharp crashes in VirtualBox

-3

I am trying to run a simple WPF application (x86) using CefSharp WPF (75.1.141) in VirtualBox Windows 10 x64, but it crashes when I try to render a web browser. It runs normally on the developer's machine Windows 10 x64 using Visual Studion 2017 WPF compiling in .Net Framework 4.5.2.

I already tried changing Cefsharp version to 71.0.0 but it didn't help. Also I tried cefsharp settings with commandline arguments "disable-gpu", "no-proxy-server", nothing changed.

Here are the MainWindow.xaml.cs code

ChromiumWebBrowser browser;
        public MainWindow()
        {
            InitializeComponent();
            Init();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (Init())
            {
                if (browser == null)
                {
                    browser = new ChromiumWebBrowser();
                    ((ChromiumWebBrowser)browser).IsBrowserInitializedChanged += (s, e2) =>
                    {
                        if (((ChromiumWebBrowser)browser).IsBrowserInitialized)
                        {
                            ((ChromiumWebBrowser)browser).Load(textbox_url.Text);
                        }
                    };
                    gridBrowser.Children.Add(browser);
                }
                else if (((ChromiumWebBrowser)browser).IsBrowserInitialized)
                {
                    ((ChromiumWebBrowser)browser).Load(textbox_url.Text);
                }
            }
        }
        static bool init = false;
        private bool Init()
        {
            if (init) return true;
            //Monitor parent process exit and close subprocesses if parent process exits first
            CefSharpSettings.SubprocessExitIfParentProcessClosed = true;

            var settings = new CefSettings()
            {
                //By default CefSharp will use an in-memory cache, you need to specify a Cache Folder to persist data
                CachePath = "cache",
                IgnoreCertificateErrors = true,
            };
            init = Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);
            return init;
        }
        ~MainWindow()
        {
            if (browser != null)
            {
                ((ChromiumWebBrowser)browser).Dispose();
            }
        }

Event Viewer shows these errors

1. Info
Error container 1258037397975457498, type 1
Event name: APPCRASH
Response: No data
CAB ID: 0

Problem signature:
P1: CefSharpTest.exe
P2: 1.0.0.0
P3: a8760476
P4: VBoxDispD3D-x86.dll
P5: 6.0.4.28413
P6: 5c4b57a6
P7: c0000005
P8: 0000fb19
P9: 
P10: 

Included files:
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERCA7F.tmp.dmp
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERCC07.tmp.WERInternalMetadata.xml
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERCC15.tmp.csv
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERCC26.tmp.txt

These files can be found here:
C:\ProgramData\Microsoft\Windows\WER\ReportArchive\AppCrash_CefSharpTest.exe_87545299969ed877b3362d6ccde2f935ae9a282_7a64911f_0491dc52

Analyze symbol: 
Repeated search for the issue: 0
Report Id: 011981c1-b0ed-4e02-b4fe-0361ef1885de
Report Status: 268435456
Hashed container: 952737448bb5f0a7517572591c7bdeda
2. Critical
Application: CefSharp.BrowserSubprocess.exe
Platform version: v4.0.30319
Description. The process was completed due to an unhandled exception..
Exception Details: exception code e0000008, exception address 76570882
3. Critical
Name of failed application: CefSharpTest.exe, version: 1.0.0.0, timestamp: 0xa8760476
Failed module name: VBoxDispD3D-x86.dll, version: 6.0.4.28413, timestamp: 0x5c4b57a6
Exception code: 0xc0000005
Error offset: 0x0000fb19
ID of the failed process: 0x1198
Failed application Launch Time: 0x01d55c59eed8c47d
Bad Application Path: C:\Users\Евгений\Desktop\CefSharpTest\CefSharpTest.exe
Failed module path: C:\Windows\SYSTEM32\VBoxDispD3D-x86.dll
Report Id: 011981c1-b0ed-4e02-b4fe-0361ef1885de
Failed Package Full Name: 
Bad Package Application Code: 
c#
wpf
virtualbox
cefsharp
asked on Stack Overflow Aug 26, 2019 by Eugene Smoley • edited Aug 27, 2019 by Eugene Smoley

1 Answer

1

I also tried with installed vc++ (but I wanted without). I finally managed this to work by building with cefsharp version 67.0.0 and copying msvcp140.dll and vcruntime140.dll along with .exe. Thank you for your reply anyway.

answered on Stack Overflow Aug 27, 2019 by Eugene Smoley

User contributions licensed under CC BY-SA 3.0