Stop Debugging and Start Running in Visual Studio
Date Published: 18 April 2024
NOTE: Watch the video above to see actual timings of starting with and without debugging. Vote for this feature request to make Run vs Debug more obvious in Visual Studio.. Thanks!
I work with a lot of different .NET developers as a trainer, architect, and consultant with NimblePros. One thing that I'm frequently pointing out to them is the difference in startup speed for their applications when launching from Visual Studio. Many, I would even say most, .NET developers have developed "muscle memory" of hitting F5 (or clicking the "Play" button) in order to launch their applications. And why not? This was the only toolbar button available for many years, and F5 is a simple enough key to remember, and is literally called "Start".
The (potential) problem is, the default start behavior actually means "Debug". Which means launching the Debugger, totally overhauling the UI of Visual Studio in the process, and adding often significant delay to the process.
The alternative is to "Start without Debugging" (also known as "Run" everywhere else but in Visual Studio), which is now available using a hollow "Play" icon on the toolbar as well as via keyboard shortcut, Ctrl+F5.
Which one do you use by default? If you're in the F5/Play by default camp, do me a favor and try Ctrl+F5/Hollow Play with your main app you're always working in and let me know in the comments if it makes a difference. Here's what one (of many) reply on Twitter/X found:
If you use the toolbar, think of it like this:
Personally, I like how Rider does it, which is also how the dotnet CLI works. Just call it "Run" if you want to run the app. Call it "Debug" if you want to debug the app.
You don't need to make it overcomplicated, especially for a menu item which should just be a simple verb.
None of this "Start the application but this time don't attach a debugger or do anything else but run it, ok?" menu text. And there's no need to confuse things with "Start the debugger and the application and attach the debugger to it all with this button", either. It's too verbose. It's just more words when "Debug" suffices. (Yeah, I know it's really only "Start Debugging" and "Start Without Debugging" but that's still obviously more verbose than necessary; I'm exaggerating to make a point)
Visual Studio already has a precedent for this, too, with tests:
Note that there's not menu option to "Start Tests With Debugger" or "Start Tests Without Debugger" because that's completely unnecessary.
Help Future Developers
Ok so why do I care, and why should you? My personal mission is to help developers write better code, faster. Starting the program you're writing is almost certainly a part of your development inner loop, and as such relatively small gains can quickly add up since the activity is occurring so frequently. And the investment in this case is minimal - literally just a tiny bit of education so developers can be intentional about how they want to run (or sometimes debug) their applications.
It's almost certainly too much of a change at this point for Visual Studio to change the behavior of F5/Play. But what they could do is change the menu text, so that it would become clear to developers that one option is for Debugging and the other is for Running. I ran a poll which you can see (and participate in if you're quick) what my corner of Twitter thought about this.
I also opened up this change request with Visual Studio, which you can view and vote up if you agree.
What about VS Code
Visual Studio Code is a weird hybrid of Visual Studio and Rider when it comes to the names and text they use for their menus. Whereas in Visual Studio running your app which should be one of the most common things folks do is hidden behind a top level "Debug" menu option, VS Code has a top level menu item called "Run". Makes sense so far.
But then under that menu things look like this:
You might expect that the first and default option under the "Run" menu would be "Run" or "Run the App" but no doubt because of compatibility with Visual Studio it's "Start Debugging" (which doesn't even mention "Run"). And then for the second option it's "Run Without Debugging" which again is just an overly verbose way of saying "Run". Bonus points for using "Run" instead of "Start" for the non-debugging case, but weirdly inconsistent use of "Start" and "Run" in the two options...
For me, I mostly just use the terminal and dotnet run
or dotnet watch run
when I'm in VS Code, so these don't make a huge difference in my day to day coding. But some folks in the comments of my YouTube video on this topic asked, so I thought I'd include some info here.
If you found this useful, consider sharing it with a peer and joining my weekly dev tips newsletter or subscribe to my YouTube channel. Cheers!
About Ardalis
Software Architect
Steve is an experienced software architect and trainer, focusing on code quality and Domain-Driven Design with .NET.