1

When I have a code file open and a breakpoint hits, Visual Studio automatically switches the open page to the corresponding file and places the cursor on the corresponding line.

This is quite annoying in my present use case where I'm looking at-on screen values and code lines in a shader file simultaneously, using a breakpoint and F5 to jump to the next frame will switch from the shader file to my breakpoint location.

This is not about VS stealing focus, but about preserving internal focus within VS. I just want silent breakpoint hits.

XenoChrist
  • 309
  • 1
  • 3
  • 11

2 Answers2

1

In Visual Studio 2015, you need to right click the breakpoint to choose "Action" option. It will open the Breakpoint Settings dialog. Now you can add the message that you want to write in Output window and check "Continue execution" option. After setting the output message, the breakpoint will not be hit. enter image description here

Jack Zhai
  • 6,230
  • 1
  • 12
  • 20
  • This answer is on the right path, but I do want it to stop executing. Just not refocus to the line it broke at. – XenoChrist Aug 01 '17 at 18:20
  • @XenoChrist, What I know is that stopping execution means terminating the process you are debugging and ending the debugging session. It should not be confused with breaking execution, so I think we need to stop it manually like using Stop Debugging option under debugging menu. I didn't find the feature which could stop it automatically unless we close certain UIs like web apps or desktop apps manually firstly. – Jack Zhai Aug 02 '17 at 03:12
  • Ok, I mean break execution, sorry for the confusion. – XenoChrist Aug 03 '17 at 13:19
  • @XenoChrist, Sorry for no good suggestion, use the actions, it would not focus to the code line, but we need to stop debugging manually. – Jack Zhai Aug 04 '17 at 02:38
  • @XenoChrist, Like the general C# Console app without the code line "Console.Readline()", it would stop debugging automatically even if you use the above "Actions". – Jack Zhai Aug 04 '17 at 02:59
0

In Visual Studio right click on the break point. In the context menu select the When Hit... menu option. On the When Breakpoint Is Hit dialog box check the Continue execution checkbox. Use the Print a message text box to customize a message to be written to the Debug output so you can tell the breakpoint was hit.

Gene Pool
  • 61
  • 5