Using CefSharp WPF 39.0.1 (x86) under Visual Studio 2013, I ran into crashing errors and created this simple test app (code at the end). This app starts up, loading google maps and then closes the window after a delay.
I then run the program 1,000 times from the command-line with:
for /l %f in (1,1,1000) do @testapp.exe && @echo %f && @sleep 7Out of 1,000 runs, I get 8 crashes on shutdown that are of the sort:
Problem signature:
Problem Event Name: APPCRASH
Application Name: TestApp.exe
Application Version: 1.0.0.0
Application Timestamp: 55662259
Fault Module Name: libcef.dll
Fault Module Version: 3.2171.2069.0
Fault Module Timestamp: 5511ef73
Exception Code: 80000003
Exception Offset: 0013b2d0
OS Version: 6.1.7601.2.1.0.256.48
Locale ID: 1033
Additional Information 1: 2c36
Additional Information 2: 2c3604cc63615066c18b5988e846206d
Additional Information 3: 97c6
Additional Information 4: 97c6a9c8c371c03331461cc76e6c0fc4
This is similar to some other reports of crashes, though with the code 80000003 instead of the others reported. Can anyone find any fault with my test app? Am I doing something that might be causing this problem? I'm both knew to CefSharp and C# in general, so it's quite possible I'm missing something even in this simple app. I just wanted to check here before I go reporting it as a bug in CefSharp.
I will also note that I arrived here after running into a similar error in the Delphi DCEF3 wrapper for libcef. That one happened MUCH more frequently, around 5% in the best case scenario. And it was more likely to happen when loading google maps than a simple page like
www.google.com.
------------------------------------------------
App.xaml.cs:
------------------------------------------------
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using CefSharp;
namespace TestApp
{
public partial class App : Application
{
public App()
{
Cef.Initialize(new CefSharp.CefSettings());
}
}
}
------------------------------------------------
MainWindow.xaml:
------------------------------------------------
<Window x:Class="TestApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cefSharp="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf"
WindowStartupLocation="CenterScreen"
WindowState="Minimized"
Title="TestApp" Height="350" Width="300">
<cefSharp:ChromiumWebBrowser x:Name="web"/>
</Window>
------------------------------------------------
MainWindow.xaml.cs:
------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using CefSharp;
using CefSharp.Wpf;
using System.Windows.Threading;
namespace TestApp
{
public partial class MainWindow : Window
{
public Window wind;
public MainWindow()
{
InitializeComponent();
wind = this;
web.Address = "http://maps.google.com/";
web.FrameLoadEnd += web_FrameLoadEnd;
}
void web_FrameLoadEnd(object sender, FrameLoadEndEventArgs e)
{
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromMilliseconds(5000);
timer.Tick += TimerTick;
timer.Start();
}
private void TimerTick(object sender, EventArgs e)
{
DispatcherTimer timer = (DispatcherTimer)sender;
timer.Stop();
timer.Tick -= TimerTick;
wind.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.SystemIdle, new TimeSpan(0, 0, 0, 1),
new Action(
delegate()
{
wind.Close();
}
)
);
}
}
}