Debugging add-in assemblies in Windows Media Center
As many of you have probably noticed, it can be tricky to debug problems that occur while loading and running an add-in assembly hosted within Windows Media Center. Fortunately, there are 2 fixes in post-beta 2 builds of Windows Vista that make Windows Media Center add-in debugging a little easier.
Enabling the Details button for the add-in crash dialog
The first debugging fix we have added is a registry value that will add a Details button to the error dialog that appears when a Windows Media Center add-in crashes. The registry value is located at:
EnableErrorDetails = 1 (REG_DWORD)
The Windows Media Center SDK for Windows Vista sets this value automatically starting with the 5456.5 build that is available on the Microsoft Connect site for Windows Vista beta program members, and you can also set it manually on a Windows Vista OS that contains Windows Media Center to gain the same functionality.
When you have this registry value set, you will see a dialog that looks like the following when an add-in crashes:
The Details button only appears if the registry value is set. The rest of the dialog will look the same regardless of whether or not you have the registry value set.
When you click on the Details button, Windows Media Center will display the callstack that caused the crash. It will look something like this:
Unfortunately, because of the way that Windows Media Center add-ins are hosted in an external process (ehexthost.exe) and how some of the exceptions thrown by Windows Media Center are wrapped and bubbled back up, the callstack may not always be particularly useful. However, there are many cases where this has already proven useful to our development team while trying to track down add-in crashes.
Enabling a dialog to allow you to attach a debugger
The second debugging fix we have added is a registry value that will cause a Windows Media Center dialog to appear when attempting to launch any add-in. The dialog will display the process name and process ID that you can use to attach a debugger, set breakpoints, and step through the code that is called in your add-in when Windows Media Center attempts to load and run it. The registry value is located at:
EnableAddInLaunchDebugging = 1 (REG_DWORD)
When you have this registry value set, you will see a dialog that looks like the following when attempting to launch any add-in within Windows Media Center:
While this dialog is on-screen, you can attach your debugger of choice to the specified process name/ID and then press OK to resume the Windows Media Center add-in launch process.
Unlike the previous registry value, the Windows Media Center SDK does not automatically set this value because it noticeably interferes with the ordinary usage of Windows Media Center in non-development scenarios. You will have to set this registry value yourself to gain this functionality.
Hopefully these new registry tweaks will be useful to you as you develop and debug your Windows Media Center add-ins.
A place for App developers to hang out / post
1 post • Page 1 of 1
- Posts: 1276
- Joined: Wed Feb 24, 2016 3:36 pm
- HTPC Specs:
1 post • Page 1 of 1