带有CefSharp的C#WPF在VirtualBox中崩溃

时间:2019-08-26 22:27:10

标签: c# wpf virtualbox cefsharp

我正在尝试在VirtualBox Windows 10 x64中使用CefSharp WPF(75.1.141)运行一个简单的WPF应用程序(x86),但是当我尝试呈现Web浏览器时会崩溃。 它使用.Net Framework 4.5.2中编译的Visual Studion 2017 WPF在开发人员的计算机Windows 10 x64上正常运行。

我已经尝试过将Cefsharp版本更改为71.0.0,但没有帮助。我还尝试了使用命令行参数“ disable-gpu”,“ no-proxy-server”的cefsharp设置,没有任何更改。

这是MainWindow.xaml.cs代码

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();
            }
        }

事件查看器显示这些错误

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: 

1 个答案:

答案 0 :(得分:1)

我也尝试使用已安装的vc ++(但我希望没有)。我最终通过使用cefsharp 67.0.0版进行构建并复制了msvcp140.dll和vcruntime140.dll以及.exe来实现了这一目标。无论如何,谢谢您的答复。