I've got quite a heavy WPF C# application, which I have been gradually moving over to MVVM.
After refactoring lots of the code to MVVM, now randomly when I am doing an intensive task, I get this:
System.InvalidOperationException: 'The Dispatcher is unable to request processing. This is often because the application has starved the Dispatcher's message pump.'
The stack trace is less than useful:
System.InvalidOperationException
HResult=0x80131509
Message=The Dispatcher is unable to request processing. This is often because the application has starved the Dispatcher's message pump.
Source=WindowsBase
StackTrace:
at System.Windows.Threading.Dispatcher.OnRequestProcessingFailure(String methodName)
at System.Windows.Threading.Dispatcher.RequestForegroundProcessing()
at System.Windows.Threading.Dispatcher.CriticalRequestProcessing(Boolean force)
at System.Windows.Threading.Dispatcher.InvokeAsyncImpl(DispatcherOperation operation, CancellationToken cancellationToken)
at System.Windows.Threading.Dispatcher.LegacyBeginInvokeImpl(DispatcherPriority priority, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndWrapper.Dispose(Boolean disposing, Boolean isHwndBeingDestroyed)
at MS.Win32.HwndWrapper.Finalize()
I am really struggling to debug this, whats a good approach. What I am seeing is:
This happens even when I am not interacting with the UI. I just wanted to mention that I can zoom in and out while it crashes, which is odd, because that is a WPF component invoking on the dispatcher thread, and is clearly not having an issue getting its invocations serviced.
It always crashes quick.. like in under 10 seconds. It doesn't freeze for minutes then die.
What tools / how can I analyse what is holding up the message pump?
User contributions licensed under CC BY-SA 3.0