Тёмный

STOP Debugging and Start Running in Visual Studio 

Ardalis
Подписаться 12 тыс.
Просмотров 6 тыс.
50% 1

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

Наука

Опубликовано:

 

16 апр 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 47   
@carlosirias4474
@carlosirias4474 3 месяца назад
I'm starting to use run now, thanks!
@Ardalis
@Ardalis 3 месяца назад
Great!
@vyrp
@vyrp 3 месяца назад
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.
@Ardalis
@Ardalis 2 месяца назад
Same!
@ksantacruz
@ksantacruz 2 месяца назад
Awesome thanks for sharing
@Ardalis
@Ardalis 2 месяца назад
Thanks for watching!
@shagrat1988
@shagrat1988 2 месяца назад
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!
@Ardalis
@Ardalis 2 месяца назад
You're welcome!
@IanGratton
@IanGratton 3 месяца назад
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 👍🏻
@Ardalis
@Ardalis 3 месяца назад
I don’t know shortcuts for add/remove breakpoint but I rarely do so - maybe once a week at most? But yes it’s way faster to run your app with a shortcut than moving the mouse. And dotnet watch run often works well for that case, too.
@codecomposer88
@codecomposer88 3 месяца назад
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.
@Ardalis
@Ardalis 3 месяца назад
Yep. Run and Debug. I think it’s probably too much of a change to expect F5 functionality to change. But changing the menu is a step in the right direction.
@matthiasjost
@matthiasjost 3 месяца назад
Great video! Definietly agree on that it should be made more obvious on Run vs Debug.
@Ardalis
@Ardalis 3 месяца назад
Glad you think so!
@bogy912
@bogy912 5 дней назад
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...
@Ardalis
@Ardalis 2 дня назад
Yeah I've heard nothing but good things about Rider...
@pazzuto
@pazzuto 2 месяца назад
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. :)
@Ardalis
@Ardalis 2 месяца назад
Yep! Definitely speeds up that inner loop...
@cristirusanu
@cristirusanu 2 месяца назад
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.
@Ardalis
@Ardalis 2 месяца назад
Yeah, fair enough, but you're paying a big perf penalty every time when needing to debug should be pretty rare...
@nickpolyderopoulos3491
@nickpolyderopoulos3491 2 месяца назад
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.
@Ardalis
@Ardalis 2 месяца назад
Yeah Rider's simpler Run/Debug buttons are much more clear, IMO
@JeffryGonzalezHt
@JeffryGonzalezHt 3 месяца назад
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.
@Ardalis
@Ardalis 3 месяца назад
Good tip!
@unskeptable
@unskeptable 3 месяца назад
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.
@Ardalis
@Ardalis 3 месяца назад
It varies. Most of my work is on backend and APIs, not client apps, so I don't use it that often. But when I have, my experience has definitely been... mixed.
@duznt-xizt
@duznt-xizt 3 месяца назад
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.
@Ardalis
@Ardalis 3 месяца назад
Nice! I haven't used Rider (yet) but that sounds like a fast/efficient way to go.
@waelouf
@waelouf 2 месяца назад
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
@Ardalis
@Ardalis 2 месяца назад
Same!
@SageMadHatter
@SageMadHatter 3 месяца назад
Depends on what sort of work you do. Web world makes sense, but not for other fields.
@Ardalis
@Ardalis 2 месяца назад
Good point; for WinForms, WPF, etc. it may be fine to start with debugging most of the time.
@alfflasymphonyx
@alfflasymphonyx 3 месяца назад
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
@Ardalis
@Ardalis 3 месяца назад
The intent is to help folks who are new to the tool to better understand the implications of the different options. I don't think giving them these instructions is likely to be the most helpful way to communicate that to new users.
@alfflasymphonyx
@alfflasymphonyx 3 месяца назад
@@Ardalis Hi, My intent the same as yours: trying to help. If they can rename at least one button to Run, this surely would help. The toolbar would show, Debug and Run as two separate buttons. I understand it is a bit tricky to rename the button, but I'm only using the tools Visual Studio offers for now until a new version comes along with potentially the two buttons renamed as you suggested. It is merely a temporarily fix... as long as devs @ Microsoft aggree to change the buttons.
@Ardalis
@Ardalis 3 месяца назад
See also article here: ardalis.com/stop-debugging-start-running-visual-studio/
@AK-vx4dy
@AK-vx4dy 3 месяца назад
SImply running somewhat undermines using VS as whole ;) Do you know it is with hot reload in this option ? Is it available ?
@Ardalis
@Ardalis 3 месяца назад
How so? Do you ever "simply compile" or "simply run tests"? It's a Studio because it has a ton of different functionality at your fingertips. But you don't have to use bits of it that you don't need, all the time, if it slows you down. Hot reload is an option for some kinds of apps some of the time. I've had mixed results using it, so most of the time I just update code, run or update code, run tests.
@AK-vx4dy
@AK-vx4dy 3 месяца назад
@@Ardalis Yes i do ;) I wrote "somewhat" because if you stubborn you can simply compile from command line, not even bother to load this "ton of functionality" behemoth. This what i was try to write about. Yes results are mixed, but some times you can update code "on the fly" and/or move execution few lines back or change some variable and redirect execution to diffrent path. It is very useful in large projects when you must test from UI level or replay conditions of problem manualy. It saved me much time.
@pdurchev
@pdurchev 3 месяца назад
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 😊
@Ardalis
@Ardalis 3 месяца назад
Very true!
@moeinsamarehshafeei2884
@moeinsamarehshafeei2884 3 месяца назад
How about VS Code Ardalis?
@Ardalis
@Ardalis 3 месяца назад
I usually just use the CLI when I'm in VS Code, so `dotnet run` or `dotnet watch run` works fine. I think I've used the VS Code debugger maybe 2 times, ever. I'm open to others' thoughts on this, though, especially from those who do debug vs. run in VS Code frequently.
@melihyilman8803
@melihyilman8803 3 месяца назад
lip sync stopped 4:58 :) i tought you'll show the attach button for debugging it might be usefull
@Ardalis
@Ardalis 3 месяца назад
Good point - if you don't *start* with debugging you can still attach the debugger as needed. I probably should have shown that, though to be honest I very rarely do that myself.
Далее
When To Validate and When To Throw Exceptions?
11:00
Debunking Kafka Top 5 Use Cases
10:02
Просмотров 14 тыс.
НРАВИТСЯ ЭТОТ ФОРМАТ??
00:37
Просмотров 1,9 млн
Coding Was Hard Until I Learned THESE 5 Things!
7:40
C++ Super Optimization: 1000X Faster
15:33
Просмотров 306 тыс.
Improve Your Code with Ardalis GuardClauses
10:37
Просмотров 2,9 тыс.
An Illustrated Guide to OAuth and OpenID Connect
16:36
Просмотров 568 тыс.
Brutally honest advice for new .NET Web Developers
7:19
[C#] Open Source Packages Updates
2:03:59
Просмотров 502
I tried 10 code editors
10:28
Просмотров 2,9 млн
Красиво, но телефон жаль
0:32
Просмотров 1,4 млн