How to Prevent Visual Studio Debugging Stopping when Browser Closed

As a web developer it is really frustrating when you close the browser tab or window only for Visual Studio Debugging to assume that you're done with the debugger as well. Turning this setting OFF will keep Visual Studio Debugger running when you close browser windows.

By Tim TrottC# ASP.Net MVC • August 11, 2019
How to Prevent Visual Studio Debugging Stopping when Browser Closed

Visual Studio has a setting that automatically stops the debugger from running when the project output window process is terminated. This, however, can be very annoying for three reasons.

Firstly, you may have closed the window by accident or do not actually want the debugger to end. Starting the debugger again can take a long time to recompile and launch. Secondly, you may have opened other websites using the same browser process, and stopping the debugger in Visual Studio will terminate the browser, so you will lose those tabs as well. This can also close other windows or tabs launched from the main project output browser.

Breaking the Link Between Visual Studio Debugger and the Browser

Luckily, there is a setting within Visual Studio that will unlink the debugger and the browser so that closing the browser does not end the debugger, and ending the debugger does not close the browser.

Locating this setting is a breeze. Simply open the Visual Studio Options dialogue from the Tools menu and select Options. Then, navigate to Web Projects from the Projects and Solutions tree. This straightforward process empowers you to take control of your debugging experience.

Prevent Visual Studio Debugging Stopping when Browser Closed
Prevent Visual Studio Debugging Stopping when Browser Closed

Now, untick the option box that says 'Stop debugger when the browser window is closed, close browser window when the debugger stops '. This will prevent the debugger from stopping when the browser window is closed and vice versa.

Once you've made the change and clicked OK, you can be confident that the browser window will not close when you stop debugging. Even when you close the browser window, the debugger will continue running. This reassurance can help you focus on your development tasks without worrying about unintended browser closures.

About the Author

Tim Trott is a senior software engineer with over 20 years of experience in designing, building, and maintaining software systems across a range of industries. Passionate about clean code, scalable architecture, and continuous learning, he specialises in creating robust solutions that solve real-world problems. He is currently based in Edinburgh, where he develops innovative software and collaborates with teams around the globe.

Related ArticlesThese articles may also be of interest to you

CommentsShare your thoughts in the comments below

My website and its content are free to use without the clutter of adverts, popups, marketing messages or anything else like that. If you enjoyed reading this article, or it helped you in some way, all I ask in return is you leave a comment below or share this page with your friends. Thank you.

This post has 3 comments. Why not join the discussion!

New comments for this post are currently closed.