Microsoft KB Archive/274356

= PRB: Cannot Debug a .pac File from Visual InterDev =

Article ID: 274356

Article Last Modified on 2/12/2007

-

APPLIES TO


 * Microsoft Internet Explorer 5.5
 * Microsoft Internet Explorer 5.01
 * Microsoft Internet Explorer 5.5
 * Microsoft Internet Explorer 5.01
 * Microsoft Visual InterDev 6.0 Standard Edition

-



This article was previously published under Q274356



IMPORTANT: This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows Registry



SYMPTOMS
When you try to attach the Visual InterDev debugger to a .pac file, the .pac file does not appear in the Running Documents list.



CAUSE
This problem is caused by how Microsoft JScript interacts with a debugger that attaches to Internet Explorer.



RESOLUTION
WARNING: If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.

To resolve this problem, you must set the following registry key for Just-In-Time (JIT) debugging to work with JScript version 5.1 or later:

HKEY_CURRENT_USER/Software/Microsoft/Windows Script/Settings

This key contains a value called JITDebug. Set the value of this key to 1. If the JITDebug key does not exist, you can add it as a decimal DWORD in the Settings key. In addition, give the appropriate users read permissions on this key.



Create and Set a Reference to a .pac File
  Create a .pac file called Sample.pac, and paste the following code: alert(&quot;Pac file used&quot;); alert(&quot;Second Alert&quot;); alert(&quot;Last Alert&quot;);  Save Sample.pac to the root folder of the default Web site. In Internet Explorer, on the Tools menu, click Internet Options. On the Connections tab, click LAN Settings. In the Local Area Network (LAN) Settings dialog box, select the Use automatic configuration script check box, and type http://WebServerName/Sample.pac .</li> Make sure that the Automatically detect settings and Use a proxy server check boxes are cleared, and then click OK twice.</li></ol>

Debug .pac File

 * 1) In Internet Explorer, set your home page to about:blank so that Internet Explorer won't run the .pac file until you are attached to the IExplore process.
 * 2) In Visual InterDev, cancel the New Web Project dialog box because you don't need an open project to debug a .pac file. On the Debug menu, click Processes.
 * 3) In the Processes dialog box, select the IExplore process from the list, and click Attach. Close the dialog box.
 * 4) In Internet Explorer, browse to any Web site (for example, www.microsoft.com). The first alert box from the .pac file appears. Before you click OK, return to Visual InterDev.
 * 5) In Visual InterDev, on the View menu, click Debug Windows, and then click Running Documents. This should list the .pac file as &quot;JScript - script block&quot;, but only lists the Web site that you entered in step 4 (www.microsoft.com).

<div class="references_section">