You’re deep in a debugging session in Visual Studio, you stop the debugger, and suddenly all your open Chrome or Edge browser windows vanish. Not just the one your web app was running in, but every single one. Frustrating, right? This unexpected behavior can disrupt your workflow and leave you wondering what’s going on.
The Problem: Debugger Stops, Browsers Disappear
When debugging a web application in Visual Studio, stopping the debugger can lead to the closure of all open instances of your browser (be it Chrome or Edge). This happens regardless of whether those browser windows were opened by Visual Studio or by you for other tasks. This issue has been noted by developers, even after updating Visual Studio to recent versions.
Why is This Happening?
It appears this isn’t strictly a Visual Studio bug, but rather an issue related to Chromium, the underlying engine for both Google Chrome and Microsoft Edge. A bug report on the Chromium issues tracker (Issue 422218337) points to this as the source of the problem. Therefore, the ultimate fix will likely come from updates to these browsers.
The Solution (and a Workaround)
The most effective way to prevent all browser windows from closing is to close the browser window that your application is running in to stop the debugger, instead of stopping the debugger directly from Visual Studio. This method tells the debugger to halt because the browser it was attached to has closed, sidestepping the issue that causes all windows to close.
Temporary Workaround in Visual Studio Settings
If the above isn’t ideal, there’s a setting in Visual Studio that can offer some relief, though with a trade-off.
You can navigate to:Tools > Options > Projects and Solutions > Web Projects
Then, uncheck the option:"Stop debugger when browser window is closed, close browser when debugging stops"
Also read:
By disabling this, Visual Studio will no longer automatically close the browser window it launched when you stop debugging. However, this means the tab with your web application will remain open, and you’ll need to close it manually. This is a workaround, not a complete solution, as it doesn’t address the core issue of all browser windows closing if you stop the debugger via Visual Studio itself.
It’s worth noting that while some users initially reported that updating Visual Studio to version 17.14.3 fixed the issue, others on the same version still experienced the problem, indicating the Chromium-level bug is the primary culprit. Keep an eye out for Chrome and Edge updates, as these will likely contain the permanent fix.
This error has been fixed, just update your chromium based browser, tested on Chrome.
Agreed, A quick update is the solution
No, this is not fix but only workaround. After uncheck “Stop debugger when browser window is closed, close browser when debugging stops” you need to close the debugging browser’s tab manually. The automatic close of debugging window or tab worked before normally without touching other browsers tabs/windows.
Please vote here for solve this issue https://developercommunity.visualstudio.com/t/Visual-Studio-Closes-All-Browser-Windows/10919792.
I support you. Upvoted +1