Debugging Hosted HTML Applications

Because one of the primary design goals of Windows Media Center is to keep interruptions of the media experience to a minimum, Windows Media Center does not display error messages for scripting errors in HTML applications. Therefore, you must use another method to debug your scripting code, such as the debugging capabilities provided by an IDE such as Visual Studio.

The following procedure describes how to debug your application's scripting code by using the Visual Studio debugger.

  1. Close Windows Media Center and then start Internet Explorer.
  2. On the Internet Explorer Tools menu, click Internet Options.
  3. In the Internet Options dialog box, click the Advanced tab, and then ensure that the Disable script debugging (Other) setting under Settings is not selected.
  4. Click OK, and then close Internet Explorer.
  5. Start Windows Media Center.
  6. While Windows Media Center is running, switch back to the Windows Vista user interface and start Visual Studio.
  7. In Visual Studio, open the application source file that you want to debug, setting breakpoints as needed.
  8. From the Tools menu, choose Attach to Process. A dialog box is displayed that lists all running processes on your system. Select ehshell.exe.
  9. Click Select, and then in the Select Code Type dialog box, select Debug these code types, and then select Script. Click OK.
  10. Click the Attach button.
  11. Switch back to Windows Media Center and run your application.

When Windows Media Center encounters a breakpoint or scripting error, Windows Media Center stops executing as control transfers to the Visual Studio debugger. When this happens, press ALT+TAB to switch to Visual Studio and debug your application.

If a hosted HTML application causes Windows Media Center to stop responding for a long period of time, Windows Media Center automatically closes and submits a crash report that can help Microsoft and the application vendor improve the application. Although this feature is useful for identifying and fixing problems with applications on an end user's computer, it can interfere with the debugging process. To disable this feature while debugging, set the following registry key to a negative number:

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Media Center\HangDetectionTimeout

See Also