Browse Source
Fixed expected output in failing NRefactory unit test. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3824 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
3 changed files with 42 additions and 1 deletions
@ -0,0 +1,40 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <author name="Daniel Grunwald"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Windows.Threading; |
||||||
|
|
||||||
|
namespace ICSharpCode.Core.Presentation |
||||||
|
{ |
||||||
|
public static class DispatcherErrorHandler |
||||||
|
{ |
||||||
|
[ThreadStatic] static bool isRegistered; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers the WPF error handler for this thread.
|
||||||
|
/// If the error handler is already registered, this method does nothing.
|
||||||
|
///
|
||||||
|
/// WPF applications should call this method when they initialize to prevent
|
||||||
|
/// SharpDevelop from crashing completely when there is an error in WPF event handlers.
|
||||||
|
/// </summary>
|
||||||
|
public static void Register() |
||||||
|
{ |
||||||
|
if (!isRegistered) { |
||||||
|
isRegistered = true; |
||||||
|
Dispatcher.CurrentDispatcher.UnhandledException += DispatcherUnhandledException; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
static void DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) |
||||||
|
{ |
||||||
|
if (!e.Handled) { |
||||||
|
e.Handled = true; |
||||||
|
MessageService.ShowError(e.Exception, "Unhandled WPF exception"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue