Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>An <code>AppDomain.UnhandledException</code> handler is wired as: </p> <pre><code>AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; </code></pre> <p>But I could not find a way to flag as handled in the handler - so this always seems to result in an app shut down no matter what you do. So I do not think this is a lot of use. </p> <p>Better to handle <code>Application.Current.DispatcherUnhandledException</code> and to test for <code>CommunicationObjectFaultedException</code> - as you can recover from that by just re-initializing your proxy - exactly as you did at initial connection. E.g: </p> <pre><code>void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { if (e.Exception is CommunicationObjectFaultedException) { //|| e.Exception is InvalidOperationException) { Reconnect(); e.Handled = true; } else { MessageBox.Show(string.Format("An unexpected error has occured:\n{0}.\nThe application will close.", e.Exception)); Application.Current.Shutdown(); } } public bool Reconnect() { bool ok = false; MessageBoxResult result = MessageBox.Show("The connection to the server has been lost. Try to reconnect?", "Connection lost", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) ok = Initialize(); if (!ok) Application.Current.Shutdown(); } </code></pre> <p>where Initialize has your initial proxy instantiation/connection code.</p> <p>In the code you posted above I suspect that you are handling <code>DispatcherUnhandledException</code> <strong>twice</strong> - by wiring a handler in xaml AND in code.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload