March 7th, 2017

Run To Click Debugging in Visual Studio 2017

Aaron Hallberg
Partner Director of Product

You have many options when navigating through your code with the debugger in Visual Studio including setting breakpoints, stepping, and using Run to Cursor. In Visual Studio 2017 we have introduced Run to Click, a new way to more easily debug your code – point and click style. You no longer need to set temporary breakpoints or step several times to execute your code and stop on the line you want. You now can get all the benefits of Run to Cursor (Ctrl+Shift+F10) without searching through the context menu or taking your hand off the mouse for a two handed shortcut combination. Run to Click works while debugging in any programming language in VS including C#, VB, C++, and Python.

Point and Click Debugging

When stopped at a break state under the debugger, a light green “run execution to here” glyph subtly appears next to a line of code where your mouse is hovered.

RunToClickICONOff

Move your mouse to the glyph and click the button. Your code will run and stop on that line the next time it is hit in your code path.

RunToClickICONOn

This is especially useful if you naturally have one hand on the mouse while debugging to inspect variables with data tips in your code. You can quickly Run to Click a line of code, inspect the variables on that line, and then continue debugging all while keeping focus and attention in that location. Run to Click between the same method, different methods, and within loops!

RunToClickBasic

Special Notes

Remember that Run to Click will run the execution of your application that you are debugging until that line of code is reached.

  • If you click on a line of code that won’t be hit, the application with finish executing.
  • If you click on a line of code that resumes the application waiting for additional user input, once that code path is triggered by the input, you will break where you performed the Run to Click.
  • If you Run to Click on a line and the execution path triggers a breakpoint, the debugger will stop at any breakpoints in the path. When you hit “continue” (F5) execution will continue and you will stop on the line where you triggered run to click (just like if you had set a breakpoint on that line).

You can turn off Run to Click from the checkbox Debug/Options/Enable Run to Click.

Wrap Up

Run to Click improves your productivity by helping you get to the code you want to inspect faster. Try it out by downloading Visual Studio now (https://www.visualstudio.com/downloads/) and let me know what your think! We are always wanting your feedback so drop your questions and comments in the section below, or tweet @VS_Debugger.

Author

Aaron Hallberg
Partner Director of Product

Aaron has been part of the Azure DevOps team since Team Foundation Server 2008, first as a developer and now in product.

6 comments

Discussion is closed. Login to edit/delete existing comments.

  • jingzhe wang

    Do the PM realy use this feature? How  to select first word correctly with this feature?

  • jingzhe wang

    I just wan to select some lines,but somehow I clocked this icon.We all konw that something annoying just happened

  • jingzhe wang

    Just tell us how to close it in vs 2017?
    Or we must install a new vs 2019?

  • Zak McKracken

    Most annoying ‘feature’ EVER.  Resulted in many a rage quit of debugging sessions.  The magic green icon that pops up under the cursor just as I’m clicking to reposition the caret.
    Note to the VS team: that margin on the left is for mouse selection — don’t fill it with crap!

  • Zak McKracken

    Most annoying ‘feature’ EVER.  Resulted in many a rage quit of debugging sessions.  The magic green icon that pops up under the cursor just as I’m clicking to reposition your caret.
    Note to the VS team: that margin on the left is for mouse selection — don’t fill it with crap!

    • jingzhe wang

      Most annoying ‘feature’ EVER.  

      Hey,do you find some ways to close this feature?I’m Annoying