WPF and Application.ThreadException

Possible duplicate:
WPF Global Exception Handler

Hello SO, since the "good old" days of WinForms, I am writing client code similar to

static void Main (string[] args) { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; System.Windows.Forms.Application.ThreadException += Application_ThreadException; // actual application ;) } private static void Application_ThreadException ( object sender, ThreadExceptionEventArgs e) { // log error and terminate application ... } private static void CurrentDomain_UnhandledException ( object sender, UnhandledExceptionEventArgs e) { // log error and terminate application ... } 

I have since graduated from WPF, and I'm curious about the WPF mechanisms for handling errors / reporting. In particular,

  • will an unhandled error in a Gui WPF thread still raise an Application.ThreadException event?
  • Is there a WPF counterpart to Application.ThreadException ?
  • is AppDomain.UnhandledException sufficient for all unhandled exceptions that occur in a WPF application?

EDIT: sorry guys just found this , closing the question. oh, summarize

  • The WPF equivalent to System.Windows.Forms.Application.ThreadException is System.Windows.Application.DispatcherUnhandledException [this is an instance member, so the Application.Current link to find it!]

Now I can leave System.Windows.Forms forever! w00t!

+3
source share

All Articles