The Run to Click feature is a debugging feature that allows you to run to a line of code without setting a breakpoint.
- [Instructor] I'd like to show you a simple debugging feature called Run to Click. The idea is you put a break point in your code, like I have here in my MainWindow.xaml.cs file on line 15, and then you run the application by pressing Start. That will run the application and attach a debugger. Now, what we're seeing here is my WPF UI. Now, you're seeing two things here, the UI that I created, which is the white window and this button, and overtop of that is this black toolbar that's obscuring my button.
This is a debugging feature from Visual Studio, and I don't need it. So I'll show you how to turn off this feature before I show you the Run to Click feature. You turn back to Visual Studio, go to Tools, Options. Find the debugging section. General, and then, we're looking for this area. Enable UI Debugging Tools for XAML. And uncheck this check mark, show runtime tools in application.
Now I can look at the feature, Run to Click. So, we'll start the debugging session again. Click on this button, which is my first break point. And Visual Studio has always had this feature of allowing me to run to a line of code without having to add a break point. One way I could go down to this line of code, line 21, is to put a break point over here, but then I have to remember to take it out later, if it's a temporary break point. So instead, I can right-click on this line, and choose Run To Cursor, or Control + F10.
So that runs through all my code, and then stops on the line of code that contains my cursor. The new feature works in a similar fashion. You come down to the line of code that you want to stop on, let's say it's this line, 18, and you'll see over on the left side is a green triangle. That is a button, and when I hover over it, on the bottom, below my cursor, you'll see a tool tip that says run execution to here. So that means if I click on this green button, it will run to that line and then stop.
Let's put it on this curly brace. So what you see is a feature that's very similar to Run to Cursor. So that means it's your choice. If you like Run to Cursor, and you're already using it, keep using it; it still works. If you like this new feature; you like clicking on these floating green buttons, then use the new Run to Click feature.
- Installing Visual Studio 2017
- Using debugging features
- Reviewing document navigation enhancements
- Examining IntelliSense Improvements
- Using XAML tools
- Reviewing the tooling added to support Docker containers
- Debugging without the hosting process
- Using the Visual Studio 2017 Installer