STOP Debugging and Start Running in Visual Studio
HTML-код
- Опубликовано: 16 апр 2024
- 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
github.com/dotnet-architectur...
github.com/DevBetterCom/DevBe...
/ 1780290422213915131
/ 1780290038162424225
Vote up this VS feature request if you agree:
developercommunity.visualstud...
Check out my courses:
dometrain.com/course/getting-...
dometrain.com/course/deep-div...
ardalis.com/training-classes/
www.pluralsight.com/authors/s...
Team Consulting and Training: NimblePros.com and @nimblepros
Developer Group Mentoring: devBetter.com
Free Weekly Email Tips:
ardalis.com/tips/
If you read this far, I hope you liked this video and will consider subscribing to my channel!
Find me:
ardalis.com
/ ardalis
github.com/ardalis
/ stevenandrewsmith
bsky.app/profile/ardalis.com
#dotnet #visualstudio #webapis #aspnet #aspnetcore #debugging
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!
See also article here:
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. :)
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.
I'm starting to use run now, thanks!
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.
Awesome thanks for sharing
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.
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.
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.
Great video! Definietly agree on that it should be made more obvious on Run vs Debug.
Depends on what sort of work you do. Web world makes sense, but not for other fields.
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.
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
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 😊
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.
This can help a little:
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.
SImply running somewhat undermines using VS as whole ;)
lip sync stopped