Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS2008 debugging with firefox as default browser - how to make the debugger stop/close on exit?

I have Firefox as my default browser on my dev machine and when I start debugging from visual studio Firefox launches as I would expect and all the attributes of the experience are the same as IE except for one thing - when I close the browser. When using IE, when I close the browser visual studio will automatically shut down the debugger. When I close FF I do not get this behavior - does anyone know how to make this happen?

like image 257
keithwarren7 Avatar asked Nov 26 '08 17:11

keithwarren7


People also ask

How do you stop browser closing automatically when you stop debugging on VS 2022?

To find this setting, open the Visual Studio Options dialog from Tools menu and select Options. From there, locate Web Projects from the Projects and Solutions navigation tree. Now untick the option box that says "Stop debugger when browser window is closed, close browser window when debugger stops."

How do I stop debugging in Visual Studio?

To end a debugging session in Microsoft Visual Studio, from the Debug menu, choose Stop Debugging.


2 Answers

The reason for this behavior is very simple: Visual Studio attaches itself to the process to be debugged, and will drop out of run mode if it sees that process terminate. FireFox does not create a new process every time a window is launched: it reuses the existing process. IE is able to create a new one for each window (depends on option settings). If you already have FF running and you launch an app to be debugged, the app window is created in the existing process and VS attaches to that process. When you close the app window the process doesn't terminate because it is still active for the pre-existing windows. Next time it happens close all the other FF windows and you will see Visual Studio drop out of debug run mode. If there was a way to tell FireFox to create a new process for a new window then this problem would go away. I haven't found any reasonably reliable way to do that.

like image 155
Mark Avatar answered Sep 26 '22 19:09

Mark


To add to Mark's answer, you can setup a specific "debug" profile for firefox, and then change the project's properties/Web, select there "start external program" and browse to firefox.exe, and set commandline arguments to '-no-remote -P "MyDebugProfile" '.

To manage your profiles, start (from command-line) firefox like this:

c:\> <installation path of ff>\firefox.exe -profilemanager

There, you create a new profile (lets say "debug")

To start a new process of FF with this profile (i.e. what you set for VS):

c:\> <install path to ff>\firefox.exe -no-remote -P "debug" "http://mysite"

Note, that the "-P" parameter is case sensitive.

like image 35
Sunny Milenov Avatar answered Sep 22 '22 19:09

Sunny Milenov