Search code examples
visual-studio-2017visual-studio-debugging

Why does the VS Solution Explorer Script Documents list keep growing and how do I use those links?


When we debug an MVC5 application, links are provided to access the running scripts as shown below. This is for a basic MVC5 application that has had absolutely no modifications:

enter image description here

If we simply refresh the screen 3 times on the home page, the list displayed gets longer as shown below:

enter image description here

I've never really tried to debug a script yet. I have used the html links to view pages and I understand I can open one of the .js files, set a breakpoint and try to debug a script. But why are there so many links?. I would have thought I only need a single link for any given script or page that is in progress; that the links would go away when the script or page is no longer active. Clearly I'm missing something about the constantly growing list.

Could someone provide a brief explanation of this feature and how I will use it. My book on Visual Studio mentions this feature, but doesn't provide enough text for me to get a handle on this aspect of the feature.


Solution

  • This looks like a bug in the Edge debug adapter. Specifically, the adapter is supposed to send an event when the page refreshes (or a navigation occurs) to clear out old scripts that are no longer valid for the new execution context (here's a link to the event description in the debug adapter protocol if you're curious).

    We've opened an issue on the GitHub project where you can track the progress of the fix.

    For a workaround in the mean time, if you click on the bottom-most duplicate script in the list, that should be the latest loaded version, and should work without error.

    *EDIT:

    We've got a fix for the issue which should be out with 16.2 Preview 2 of Visual Studio.