I have a complicated WPF application that is used on some kind of a PA system. It shows videos time to time and sometimes it does play music and different text messages on the screen.
Structure is pretty straight forward. There is a server that has 2 methods. SetMessage("String"); and GetMessage("String");
Client once in 5 seconds connects to the server via HTTP binding on WCF and pulls GetMessage(). Admin app connects to the server and calls SetMessage().
In the App.xml.cs i have a handlers for CurrentDomain_UnhandledException, OnDispatcherUnhandledException, TaskScheduler.UnobservedTaskException and application.Current.DispatcherUnhnandledException. All of them suppose to do nlog and continue operation.
There is one page in the App that uses Media element to play short videos. Time to time after video was played I'm getting app crash.
EventType : clr20r3
P1 : Client.exe
P2 : 0.0.2.0
P3 : 5226863e
P3 : mscorlib
P5 : 4.0.0.0
P6 : 4ba1da6f
P7 : 219
P8 : 10
P9 : system.invalidoperaionexception
Now that's all cool. Yet the problems are:
- Despite of 4 different exception handlers I'm still geting the exception
- I'm not able to debug on the client computer
- Error is random but happens after I played the video.
- Code to stop and start the video is in Dispatcher.Invoke(new Action).
- I might just leave the page and switch to another one before doing stop of the video.
Looks like I'm just violating some access and trying to change something in code from another thread.
Funny thing is that I tried to do ILDasm and find that P7:219 and there is none in the code.
Is there any way to catch that freaking exception?
(I actually spend around 30 mins, trying to find any similar problems here, but all the solutions already applied in my code)
Thanx for help.