How to handle a rendering Exception in WPF (Windows Presentation Framework)

Asked

Viewed 129 times

1

Randomly my system causes this Exception (which I only see because of the logs left in Windows events). It’s an app that runs around 24 hours a day every day. When error occurs, the screen freezes and if I click anything, the program closes with Windows error message.

I already implemented a memory management with GC but apparently this is not the problem.

The point in question is that I can not find where the problem is, since I debugged the whole project, made unitary tests and everything goes perfectly, besides for my understanding, these classes are of the Framework itself . NET, more specifically the rendering part.

Every time it occurs, although it is difficult to occur, it is the same Exception, and I do not know how to treat it.

How can I identify the source of this problem or treat this Exception? If there was a way to just treat Exception so the application wouldn’t crash it would already help.

Aplicativo: StreamWpf.exe
Versão do Framework: v4.0.30319
Descrição: O processo foi terminado devido a uma exceção sem tratamento.
Informações da Exceção: System.Runtime.InteropServices.COMException
Pilha:
   em System.Windows.Media.Composition.DUCE+Channel.SyncFlush()
   em System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean, System.Nullable`1<ChannelSet>)
   em System.Windows.Interop.HwndTarget.UpdateWindowPos(IntPtr)
   em System.Windows.Interop.HwndTarget.HandleMessage(MS.Internal.Interop.WindowMessage, IntPtr, IntPtr)
   em System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   em MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   em MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
   em System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   em MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   em System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
   em MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
   em MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr, IntPtr, Int32, IntPtr, IntPtr)
   em MS.Win32.HwndSubclass.DefWndProcWrapper(IntPtr, Int32, IntPtr, IntPtr)
   em MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr, IntPtr, Int32, IntPtr, IntPtr)
   em MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
   em MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr, IntPtr, Int32, IntPtr, IntPtr)
   em MS.Win32.HwndSubclass.DefWndProcWrapper(IntPtr, Int32, IntPtr, IntPtr)
   em MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr, IntPtr, Int32, IntPtr, IntPtr)
   em MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
   em MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
   em System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
   em System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
   em System.Windows.Threading.Dispatcher.Run()
   em System.Windows.Application.RunDispatcher(System.Object)
   em System.Windows.Application.RunInternal(System.Windows.Window)
   em System.Windows.Application.Run(System.Windows.Window)
   em StreamWpf.App.Main()

Nome do aplicativo com falha: StreamWpf.exe, versão: 2.0.0.0, carimbo de data/hora: 0x5981bd3b
Nome do módulo com falha: KERNELBASE.dll, versão: 6.2.9200.16864, carimbo de data/hora: 0x531d2c84
Código de exceção: 0xe0434352
Deslocamento da falha: 0x00011a65
ID do processo com falha: 0xf28
Hora de início do aplicativo com falha: 0x01d30d1967a85ab5
Caminho do aplicativo com falha: C:\Program Files\Stx\StreamWpf.exe
Caminho do módulo com falha: C:\Windows\system32\KERNELBASE.dll
ID do Relatório: abd4667b-8273-11e7-afa6-0019b9fb11aa
Nome completo do pacote com falha: 
ID do aplicativo relativo ao pacote com falha: 

1 answer

1


Speak Renan, if I tell you that I spent the day yesterday with this same problem heheheh.

Well what I got was to use this:

AppDomain.CurrentDomain.UnhandledException += (sender, e) => MessageBox.Show(e.ExceptionObject.ToString());

In the Mainwindow of my application and then yes go treating every problem, see if it helps you.

  • Thanks @Otto! I’m going to test this solution. I was already starting to get desperate.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.