Disabling script debugging in VS 2008 + IE8

Visual Studio 2008 shipped with a feature to automatically enable script debugging when starting IE8 from Visual Studio. In other words, if you are using VS 2008 and IE8, there is no longer a need to tweak IE options to debug your site.

However, this feature unfortunately created a problem which we didn't notice before VS 2008 shipped - web sites which create a large number of dynamic documents can perform quite poorly under the debugger, and now there is no option to run your site outside the debugger. If you open solution explorer and see the document list under 'Script Documents' dance up and down, you are running into this problem.

Work around:

  1. This work around requires the Silverlight 2 Tools for Visual Studio 2008 SP1 to be installed. So if you don't have these tools installed, you can download them from Microsoft (http://www.microsoft.com/downloads/details.aspx?familyid=C22D6A7B-546F-4407-8EF6-D60C8EE221ED&displaylang=en). If this is not an option for you, there is some alternative work arounds at the bottom of this blog post.
  2. Right click on your project and open up project properties
  3. Go to the 'Start Options' sheet, and click the 'Silverlight' button at the bottom of the screen. Because the debugger cannot debug both Silverlight code and Script code at the same time, this will disable Script debugging and therefore avoid the problem.

Request for feedback:

If you want to disable script debugging, I would love to hear about your scenario. We are aware of the performance issues with applications that create many documents. We hope to address this in a future version of Visual Studio.

Alternative work around – disable all script debugging:

  • Open a new command prompt (start->run, cmd.exe). If you are on a 64-bit computer this needs to be a 32-bit prompt (start->run, c:\windows\syswow64\cmd.exe)
  • reg add HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\AD7Metrics\Engine\{F200A7E7-DEA5-11D0-B854-00A0244A1DE2} /v ProgramProvider /d {4FF9DEF4-8922-4D02-9379-3FFA64D1D639} /f

If you are using Visual Web Developer Express, replace 'VisualStudio' with 'VWDExpress':

  • reg add HKLM\SOFTWARE\Microsoft\VWDExpress\9.0\AD7Metrics\Engine\{F200A7E7-DEA5-11D0-B854-00A0244A1DE2} /v ProgramProvider /d {4FF9DEF4-8922-4D02-9379-3FFA64D1D639} /f

If you want to restore your computer so that you can debug scripts again:

  • reg add HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\AD7Metrics\Engine\{F200A7E7-DEA5-11D0-B854-00A0244A1DE2} /v ProgramProvider /d {170EC3FC-4E80-40AB-A85A-55900C7C70DE} /f

Work around for performance problems caused by 'anonymous code' nodes:

Some sites run into problems being debugged due to numerous "anonymous code" nodes in solution explorer. For these sites, instead of disabling script debugging completely, it's possible to disable just the 'anonymous code' nodes. This requires Visual Studio 2008 SP1. To do so:

  • reg add HKCU\Software\Microsoft\VisualStudio\9.0\Debugger /v HideAnonymousScriptCodeNodes /t REG_DWORD /d 1 /f