R – Catching MediaPlayer Exceptions from WPF MediaElement Control


I'm playing video in a MediaElement in WPF.

It's working 1000's of times, over and over again.

Once in a blue moon (like once a week), I get a windows exception (you know the dialog Dr. Watson Crash??) that happens. The MediaElment doesn't expose an error, it just crashes and sits there with an ugly Crash report on the screen.

If you "view this report" you can see it is in fact MediaPlayer that has crashed. I know I can disable the crash reports from popping up – but I'm more interested in finding out what's going wrong.

I'm not sure how to capture the results of the Dr. Watson capture, but I have the dialog open now if someone has advice on a better way to capture. Here is the opening line of data, that points to my application, then to wmvdecod.dll

AppName: ScottApp.exe
AppVer: 2.2009.2291.805
ModName: wmvdecod.dll
ModVer: 11.0.5721.5145
fDebug: 0
Offset: 000cbc88

And from the Win Event Log. (same information)

Event Type: Error
Event Source: .NET Runtime 2.0 Error Reporting
Event Category: None
Event ID: 1000
Date: 7/13/2009
Time: 10:20:27 AM
User: N/A
Description: Faulting application ScottApp.exe, version 2.2009.2291.805, stamp 4a36c812, faulting module wmvdecod.dll, version 11.0.5721.5145, stamp 453711a3, debug? 0, fault address 0x000cbc88.

Best Solution

I believe this to be a bug with the windows media decoder filter. I have experienced the same exception in other media players that DO NOT use MediaElement.

This exception is coming from native code on a thread you don't have access to. So I am unaware of how to catch these exceptions.

If you want to submit a detailed bug report to the microsoft connect site, try running this util after it crashes (DebugDiag): http://www.microsoft.com/DOWNLOADS/details.aspx?FamilyID=28bd5941-c458-46f1-b24d-f60151d875a3&displaylang=en

Add the "Crash Rule" and go through the options to generate a crash report. I will do the same and maybe they can get this fixed.

A work around for you, if possible, is to find a stable codec (divx?) and convert your Windows Media Files to this format.

You may be experiencing different results with different GPUs because the WM codec will use DXVA for hardware acceleration. I think different drivers/gpus will give different amount of reliability.

Related Question