Visual Studio Keyboard Shortcuts that Speed Up Debugging Applications | Mosh

Programming with Mosh · Intermediate ·🏗️ Systems Design & Architecture ·11y ago

Key Takeaways

This video covers essential Visual Studio keyboard shortcuts for debugging applications, including running applications with and without debug mode, setting breakpoints, and stepping through code.

Full Transcript

knowing how to use your keyboard when debuging an application is extremely important if you want to increase your productivity one of the things that I don't like about Visual Studio is this start button here on the toolbar I think it promotes the bad habit of using the mouse I've seen a lot of developers run the application using this button here and to make the matter worse they don't even know this way they run the application in the debug mode when you run the application in the debug mode Visual Studio loads extra information in the memory to provide you with the ability to debug the application this slows down your PC and affects your productivity you have to wait longer for the application to load and to respond to your actions often you just want to run the application to test your code not necessarily to debug then you shouldn't waste your time and your computer's Resources by going to the debug mode every time use the debug mode only when you're trying to fix a bug so how can we run the application without going to the debug mode you press contrl and F5 this will compile your application and launch it faster the application will also respond to your actions faster if you really need to go to the debug mode instead of pressing control and F5 press F5 only this is equivalent to pressing the start icon here on the toolbar so from now on if you ever need to debug the application make sure to use your keyboard to initiate the debugging session so let's repeat one more time because I want to make sure you really get this press contrl and F5 to run the application and press F5 to run the application in the debug mode okay now let's look at some more keyboard shortcuts that you need to know when debugging here in the main method I've created a new instance of the calculator class as you see there is a call to the add method with two arguments passed let's say this method is not working as we expect so we need to debug it we start by putting a breakpoint on this line when you insert a breakpoint and start the application in the debug mode the application code is executed until it reaches a breakpoint and then stops there to insert a breakpoint with the cursor on this line press F9 not this icon here that represents a breakpoint you can press f F9 again to remove the breakpoint now we run the application in the debug mode using F5 note that this line is highlighted we have two choices now we can step into the ad method and look exactly what's happening there or we can step over it and look at the result from a productivity point of view I recommend you to use a step over first and inspect the result if the result is not what you expect then you st step into a method to find out what's going on if you step into methods all the time you'll waste a lot of time verifying the code that may already be working so let's try this with the current line highlighted we press F10 that's the shortcut key for step over now we can inspect the result by hovering the mouse over this result variable here in this case it's okay to use your mouse to quickly inspect a few variables here and there as you see the value of the result is zero whereas I expected to be four so we need to step into the ad method to see what's going on there is just a tiny issue here the execution of code is always forward only you can't go back as you see the focus is currently on the console the right line method here so we can't go back and step into the ad method we need to stop the debugging session and start over to do this press control shift and F5 okay now we can step into the ad method to do this we press f11 so remember this to step over a method you press F10 and to step into it you press f11 these are your friends and you'll use them forever okay back to our debugging look where the execution now we can hover the mouse over these two arguments here to make sure they hold the right values as you see the input values are fine so there must be something wrong with the logic of this method note that it's returning zero instead of adding the two arguments together so let's go ahead and change the code now we press F10 to continue the ex execution and again and again and again okay now let's inspect the result variable it has the right value so let's review up to this point before I show you a few more techniques you use F5 to run the application in the debug mode you use F10 to step over a method and f11 to step into it now here is a good technique if you accidentally step into a method but your intention was to step over it you can always step out by pressing shift and F1 it's very easy to memorize this you press f11 to step into a method and shift an f11 to step out of it okay one more thing before we finish this lecture when you're in the debug mode it's possible to have multiple break points in different parts of the code that you would like to inspect if you press F4 five the execution continues until hitting the next break point sometimes you leave various break points here and there but you won't need them anymore then every time you start the debugging session those break points will get in the way and waste your time so make sure to remove them by pressing F9 if you no longer need them let's recap press contrl and F5 to run the application without debugging press F5 to run the application in the debug mode press shift and F5 to stop the debugging session press F9 to insert or remove a breakpoint press F10 to step over a method press f11 to step into it and finally press shift and F1 to step out of it I hope you enjoyed this lecture

Original Description

Get the COMPLETE COURSE: http://bit.ly/2IEk6Lo My blog http://www.programmingwithmosh.com/ Facebook https://www.facebook.com/programmingw... Twitter https://twitter.com/moshhamedani
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Programming with Mosh · Programming with Mosh · 2 of 60

1 6 Visual Studio Tips to Increase Your Productivity | Mosh
6 Visual Studio Tips to Increase Your Productivity | Mosh
Programming with Mosh
Visual Studio Keyboard Shortcuts that Speed Up Debugging Applications | Mosh
Visual Studio Keyboard Shortcuts that Speed Up Debugging Applications | Mosh
Programming with Mosh
3 Backbone.js Tutorial Part 2 - Backbone.js Models: Working with Model Attributes
Backbone.js Tutorial Part 2 - Backbone.js Models: Working with Model Attributes
Programming with Mosh
4 Backbone.js Tutorial Part 3 - Backbone.js Models: Model Validation
Backbone.js Tutorial Part 3 - Backbone.js Models: Model Validation
Programming with Mosh
5 Backbone.js Tutorial Part 4 - Backbone.js Models: Model Inheritance
Backbone.js Tutorial Part 4 - Backbone.js Models: Model Inheritance
Programming with Mosh
6 Backbone.js Tutorial Part 1 - Backbone.js Models: Creating Models
Backbone.js Tutorial Part 1 - Backbone.js Models: Creating Models
Programming with Mosh
7 Backbone.js Tutorial Part 5 - Backbone.js Models: Syncing Models with the Server
Backbone.js Tutorial Part 5 - Backbone.js Models: Syncing Models with the Server
Programming with Mosh
8 Backbone.js Tutorial Part 6 - Backbone.js Collections: Creating Collections
Backbone.js Tutorial Part 6 - Backbone.js Collections: Creating Collections
Programming with Mosh
9 Backbone.js Tutorial Part 7 - Backbone.js Collections: Working with Collections
Backbone.js Tutorial Part 7 - Backbone.js Collections: Working with Collections
Programming with Mosh
10 Backbone.js Tutorial Part 8 - Backbone.js Collections: Fetching Collections from the Server
Backbone.js Tutorial Part 8 - Backbone.js Collections: Fetching Collections from the Server
Programming with Mosh
11 Backbone.js Tutorial Part 9 - Backbone.js Views: Creating Views
Backbone.js Tutorial Part 9 - Backbone.js Views: Creating Views
Programming with Mosh
12 Backbone.js Tutorial Part 10 - Backbone.js Views: Passing Data to Views
Backbone.js Tutorial Part 10 - Backbone.js Views: Passing Data to Views
Programming with Mosh
13 Backbone.js Tutorial Part 11 - Backbone.js Views: Handling the DOM Events
Backbone.js Tutorial Part 11 - Backbone.js Views: Handling the DOM Events
Programming with Mosh
14 Backbone.js Tutorial Part 12 - Backbone.js Views: Handling the Model Events
Backbone.js Tutorial Part 12 - Backbone.js Views: Handling the Model Events
Programming with Mosh
15 Backbone.js Tutorial Part 13 - Backbone.js Views: Handling Collection Events
Backbone.js Tutorial Part 13 - Backbone.js Views: Handling Collection Events
Programming with Mosh
16 Backbone.js Tutorial Part 14 - Backbone.js Views: Templating
Backbone.js Tutorial Part 14 - Backbone.js Views: Templating
Programming with Mosh
17 Clean Code: Learn to write clean, maintainable and robust code
Clean Code: Learn to write clean, maintainable and robust code
Programming with Mosh
18 C# Events and Delegates Made Simple | Mosh
C# Events and Delegates Made Simple | Mosh
Programming with Mosh
19 C# Generics Tutorial: Whats and Whys | Mosh
C# Generics Tutorial: Whats and Whys | Mosh
Programming with Mosh
20 Debugging C# Code in Visual Studio | Mosh
Debugging C# Code in Visual Studio | Mosh
Programming with Mosh
21 Repository Pattern with C# and Entity Framework, Done Right | Mosh
Repository Pattern with C# and Entity Framework, Done Right | Mosh
Programming with Mosh
22 Angular 2 Tutorial for Beginners: Learn Angular 2 from Scratch | Mosh
Angular 2 Tutorial for Beginners: Learn Angular 2 from Scratch | Mosh
Programming with Mosh
23 Architecture of Angular 2+ Apps
Architecture of Angular 2+ Apps
Programming with Mosh
24 Working with Components in Angular
Working with Components in Angular
Programming with Mosh
25 C# Tutorial For Beginners - Learn C# Basics in 1 Hour
C# Tutorial For Beginners - Learn C# Basics in 1 Hour
Programming with Mosh
26 Difference between Junior and Senior Developers
Difference between Junior and Senior Developers
Programming with Mosh
27 Step-by-step ASP.NET MVC Tutorial for Beginners | Mosh
Step-by-step ASP.NET MVC Tutorial for Beginners | Mosh
Programming with Mosh
28 [Pluralsight]: Become a Full-stack .NET Developer
[Pluralsight]: Become a Full-stack .NET Developer
Programming with Mosh
29 Xamarin Forms Tutorial: Build Native Mobile Apps with C#
Xamarin Forms Tutorial: Build Native Mobile Apps with C#
Programming with Mosh
30 Value Types and Reference Types in JavaScript
Value Types and Reference Types in JavaScript
Programming with Mosh
31 Using Redux in Angular 2+ Apps | Mosh
Using Redux in Angular 2+ Apps | Mosh
Programming with Mosh
32 Testing Angular 2+ Apps with Jasmine and Karma | Mosh
Testing Angular 2+ Apps with Jasmine and Karma | Mosh
Programming with Mosh
33 Profile and optimize your Angular 2 apps
Profile and optimize your Angular 2 apps
Programming with Mosh
34 Build a Real-world App with ASP.NET Core and Angular 2
Build a Real-world App with ASP.NET Core and Angular 2
Programming with Mosh
35 Entity Framework 6 Tutorial: Learn Entity Framework 6 from Scratch
Entity Framework 6 Tutorial: Learn Entity Framework 6 from Scratch
Programming with Mosh
36 Two-way Binding and ngModel in Angular 4
Two-way Binding and ngModel in Angular 4
Programming with Mosh
37 Udemy Live 2017: Teaching Tech Panel
Udemy Live 2017: Teaching Tech Panel
Programming with Mosh
38 Demo of An E-commerce App Built with Angular, Firebase and Bootstrap 4
Demo of An E-commerce App Built with Angular, Firebase and Bootstrap 4
Programming with Mosh
39 My Brand New Angular Course
My Brand New Angular Course
Programming with Mosh
40 TypeScript Tutorial - TypeScript for React - Learn TypeScript
TypeScript Tutorial - TypeScript for React - Learn TypeScript
Programming with Mosh
41 Access Modifiers in TypeScript
Access Modifiers in TypeScript
Programming with Mosh
42 TypeScript Interfaces
TypeScript Interfaces
Programming with Mosh
43 TypeScript Classes
TypeScript Classes
Programming with Mosh
44 TypeScript Constructors
TypeScript Constructors
Programming with Mosh
45 TypeScript Properties
TypeScript Properties
Programming with Mosh
46 Angular Tutorial for Beginners: Learn Angular & TypeScript
Angular Tutorial for Beginners: Learn Angular & TypeScript
Programming with Mosh
47 AngularJS vs Angular 2 vs Angular 4 | Mosh
AngularJS vs Angular 2 vs Angular 4 | Mosh
Programming with Mosh
48 Angular Material Tutorial | Mosh
Angular Material Tutorial | Mosh
Programming with Mosh
49 Angular Animations Tutorial | Mosh
Angular Animations Tutorial | Mosh
Programming with Mosh
50 Firebase in Angular Applications | Mosh
Firebase in Angular Applications | Mosh
Programming with Mosh
51 Deploying Angular Applications | Mosh
Deploying Angular Applications | Mosh
Programming with Mosh
52 Building Forms in Angular Apps | Mosh
Building Forms in Angular Apps | Mosh
Programming with Mosh
53 Directives in Angular Applications
Directives in Angular Applications
Programming with Mosh
54 Routing and Navigation in Angular | Mosh
Routing and Navigation in Angular | Mosh
Programming with Mosh
55 Angular 4 in 40 Minutes
Angular 4 in 40 Minutes
Programming with Mosh
56 [NEW COURSE] Unit Testing for C# Developers
[NEW COURSE] Unit Testing for C# Developers
Programming with Mosh
57 Unit Testing C# Code - Tutorial for Beginners
Unit Testing C# Code - Tutorial for Beginners
Programming with Mosh
58 C# Classes Tutorial | Mosh
C# Classes Tutorial | Mosh
Programming with Mosh
59 C# Object Initializers Tutorial
C# Object Initializers Tutorial
Programming with Mosh
60 C# Constructors Tutorial | Mosh
C# Constructors Tutorial | Mosh
Programming with Mosh

This video teaches essential keyboard shortcuts in Visual Studio for debugging applications, covering how to run applications with and without debug mode, set breakpoints, and step through code. Mastering these shortcuts can significantly improve productivity and efficiency in debugging.

Key Takeaways
  1. Press Ctrl+F5 to run an application without debugging
  2. Press F5 to run an application in debug mode
  3. Press F9 to insert or remove a breakpoint
  4. Press F10 to step over a method
  5. Press F11 to step into a method
  6. Press Shift+F11 to step out of a method
  7. Use Shift+F5 to stop a debugging session
💡 Using keyboard shortcuts in Visual Studio can significantly improve debugging efficiency and productivity.

Related AI Lessons

How I Structured My Next.js 14 App Router Project — And Why It Scales
Learn how to structure a scalable Next.js 14 App Router project for better organization and maintainability
Dev.to · Mbanefo Emmanuel Ifechukwu
The Hardest Part Of Microservices Is Undoing What Already Succeeded
Learn how to refactor monolithic ERP systems into microservices, focusing on undoing existing successful implementations
Medium · Programming
What OOP Actually Buys You (And Why “Real World Modeling” Is a Lie)
Learn the actual benefits of Object-Oriented Programming (OOP) and why 'real world modeling' is a misconception
Medium · Programming
Data Partitioning in System Design: Why Every Scalable Application Depends on It
Learn how data partitioning enables scalable applications to handle growth without failing
Medium · Programming
Up next
Retracing It All With My Son
Ginny Clarke
Watch →