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.
- Close Windows Media Center and then start Internet Explorer.
- On the Internet Explorer Tools menu, click Internet Options.
- 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.
- Click OK, and then close Internet Explorer.
- Start Windows Media Center.
- While Windows Media Center is running, switch back to the Windows Vista user interface and start Visual Studio.
- In Visual Studio, open the application source file that you want to debug, setting breakpoints as needed.
- From the Tools menu, choose Attach to Process. A dialog box is displayed that lists all running processes on your system. Select ehshell.exe.
- Click Select, and then in the Select Code Type dialog box, select Debug these code types, and then select Script. Click OK.
- Click the Attach button.
- 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