Would there be an option or registry setting to stop Visual Studio auto focusing itself when it hit a breakpoint?
The reason why I don't want Visual Studio auto focus itself is because I tend to do multi-tasking when I debug a software. When I start the debugger, it may takes awhile for the app to compile and hits the breakpoint. I usually takes this waiting time to reply emails.
As I type my email, the debugger would make visual Studio focus on the breaking line, and I would accidentally modified the source code as I am typing my email.
This problem occurs because ASP.NET debugging isn't enabled on the application.
If a breakpoint is reached, or a signal not related to stepping occurs before count steps, stepping stops right away. Continue to the next source line in the current (innermost) stack frame. This is similar to step , but function calls that appear within the line of code are executed without stopping.
To set a breakpoint in source code: Click in the far left margin next to a line of code. You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint. The breakpoint appears as a red dot in the left margin.
Terminate a debug sessionClick the Stop button on the toolbar of the Debug tool window. Alternatively, press Ctrl+F2 and select the process to terminate (if there are two or more of them).
I wasn't able to find any sort of config setting to turn it off but was able to find someone with a workaround; tracepoint.
1. Set your breakpoint at the desired location.
2. Right-click on the red breakpoint dot icon and select “When Hit…”
3. Select “Print a message”.
4. Uncheck “Continue execution”.
You have effectively created a breakpoint that prints out the current function name and thread ID and name and then stops. Tracepoints don’t steal focus like normal breakpoints do.
Credit goes to: http://dpotter.net/technical/2009/09/problem-solved-visual-studio-stealing-focus-when-breakpoint-is-hit/
You can easily disable/enable this behaviour with the Option Settings in Visual Studio 2019:
Tools -> Options -> Debugging -> General -> Bring Visual Studio to the foreground when breaking in the debugger
I have no idea with what Visual Studio Version this feature has been added though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With