I have a webbrowser control which I have used within a WPF application, when I browse a particular url, the browser crashes thus terminating my WPF application too.
Is there a way to catch the same exception and then recover such that, I get to continue with my WPF application. I even tried instantiating it in a different AppDomain, but I have failed, is there a way out,
Please note my IE crash happens even if I open the same website using an external IE instance.
thanks
The error trace shows something about mshtml.dll.
Exact message is
Faulting module path: C:\Windows\SysWOW64\mshtml.dll
Exception code: 0xc0000602
You can try to to catch the exception through appdomain unhandled exception. Add handler in either MainWindow.cs or App.cs constructors.
MSDN reference on AppDomain.UnhandledException
public MainWindow()
{
InitializeComponent();
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
}
void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
//check e.ExceptionObject and e.IsTerminating
}
User contributions licensed under CC BY-SA 3.0