STOP Debugging and Start Running in Visual Studio

preview_player
Показать описание
Debug vs Run in Visual Studio 2022

Hey everyone, I'm Steve Smith aka ardalis, of NimblePros!

In this video we compare the performance of Debugging and Running your apps in Visual Studio 2022. This will compare using F5 - Start Debugging and Ctrl+F5 Start Without Debugging with a couple of different dotnet 8 apps.

STOP Debugging when you just want to run. Use the debugger when you need to hit breakpoints, not when you just need to run your application!

Let me know what you think or share your own tips in the comments below!

## Links

Vote up this VS feature request if you agree:

## Check out my courses:

Free Weekly Email Tips:

If you read this far, I hope you *liked* this video and will consider subscribing to my channel!

Find me:

#dotnet #visualstudio #webapis #aspnet #aspnetcore #debugging
Рекомендации по теме
Комментарии
Автор

Thanks for the video Ardalis :) I use F5 (Debug) just for the debugging, when I need to hit a breakpoint and check something at runtime. Ctrl+F5 (Run) when I want to check something on the UI or just checkt the process I made changes to :) the VS names are so so loooong, I'm a Rider user for last 6-7 years...

bogy
Автор

I totally agree. Most of the time I use F5, but I think that's a habit for me because you're always thinking "Hey if there must be a bug, I will fix it by using breakpoint without stopping the application", but now I realize that I'm losing the time. Thank you!

shagrat
Автор

I have been using Ctrl+F5 by default for a long time. I use F5 when I have a specific need, like breakpoints, break on exception, Diagnostics View, etc.

vyrp
Автор

Agreed. I'm guilty of using debug mode all the time, purely out of old habit. But I completely agree, it doesn't make any sense to run in debug mode if you are in fact not debugging. As for naming, keep it simple: "run" for run and "debug" for debug. Also naming it "run" to match the CLI is a good point. And "run", should definitely be the default F5 behavior.

codecomposer
Автор

I'm starting to use run now, thanks!

carlosirias
Автор

Steve, totally makes sense in VS to have as a perference. I guess for muscle memory folks can just re-order the buttons on the toolbar if they want to 🐭or - learn the keyboard shortcuts. Keyboard shortcuts are a must - I'm always a bit surprised when folks don't often know shortcuts for add/remove break points, continue, run to cursor, step in step out etc.


Rider is already ctrl+R and ctrl+D respectively. Important to be aware of if you need that startup overhead depending upon what you are doing 👍🏻

IanGratton
Автор

I use CTRL+F5 and, if I notice that the result is not what I expect, I go back to Visual Studio, I click CTRL+ALT+P to attach the debugger to the browser session, then set up a breakpoint and reload the page or re-perform the action that leads to the breakpoint. But I guess most of the people just click F5 from start because, in case there's something wrong, they can put a breakpoint later and refresh the page to hit it.

cristirusanu
Автор

Great video! Definietly agree on that it should be made more obvious on Run vs Debug.

matthiasjost
Автор

I leaned about ctrl+f5 pretty quickly in my days programming Windows Forms. The same with "build current project" instead of building the whole solution for a quick change. First thing I do on fresh installs, is reassign shortcuts and mod the toolbar. :)

pazzuto
Автор

At work what I usually do is that I have setup a local IIS for the web services because I rarely (if ever) change them and made powershell scripts to run the api(s) that I want to run.
I did that mostly because Visual Studio has become a performance hog on my machine to a point where one time it had 10gb of RAM.

That being said I have used both Debug and Run on other applications but not as much as I would like. Visual Studio compared to Rider makes it so much harder to run an app without the debugger almost as if it is done on purpose.

nickpolyderopoulos
Автор

The F5 thing is like stuck in so many people's muscle memory! Ctrl+F5 for stateless apps also means you can ALT-TAB back to the code, make changes, then relaunch much easier than stopping the debugger, editing, relaunching. (ignoring any possible live-reload and it's attendant frustrations!) Great stuff.

JeffryGonzalezHt
Автор

Depends on what sort of work you do. Web world makes sense, but not for other fields.

SageMadHatter
Автор

This can help a little:

Right click Toolbar
Select Customsize
In the Customize dialog, seelct Commands tab
Then choose Toolbar radiobutton
And select Standard in the dropdown
In the preview, select the icon/item you wish to midify
Click on Modify Selection
In the Modify Selection dialog, you can change the Name and the Style (Image and text)

This will however not change the tooltip. It also does not work for the button "start debugging". At least you can rename, Debug to Run

alfflasymphonyx
Автор

Normally I use run (ctrl + F5), and when I need to debug I add a breakpoint and attach to process, rarely use debug outside debugging tests

waelouf
Автор

Once you get used to just running without debugging it's very noticeable how much slower the project starts when you need to debug. It's very hard to change other people's habits though 😊

pdurchev
Автор

What I usully do in Rider is have F5 launch a "dotnet watch" profile. It automatically reloads my app when files are changed without me having to ever touch F5 again. Then when I need to debug/hit a breakpoint, i just do "Attach Debugger" and select the running watch process. Only downside is that debugging session ends everytime dotnet watch relaunches the app and I have to do a "ReAttach Debugger" to debug again. This will have to do until they get hot reload working properly in all types of projects.

duznt-xizt
Автор

How is your experience with Visual Studio 22 Hot Reload feature ? It seems very slow and buggy to me. Sometimes it detects code changes even though i didnt change anything.

unskeptable
Автор

lip sync stopped 4:58 :) i tought you'll show the attach button for debugging it might be usefull

melihyilman
Автор

SImply running somewhat undermines using VS as whole ;)
Do you know it is with hot reload in this option ? Is it available ?

AK-vxdy