Debugging C# Code in Visual Studio | Mosh

Programming with Mosh · 451K views · 2015 · 31:42

Open on YouTube

Testing, debugging & developer toolsSoftware practice, open source & careerstutorial

Why Stack Overflow recommends it

Stack Overflow users link it in comments when beginners post questions that really need run-time debugging of C# code in Visual Studio.

Recommended by 3 people across 14 different months, 2018 to 2022.

What it is

A roughly 31-minute C# tutorial from Programming with Mosh (Mosh Hamedani) on using Visual Studio's debugging tools. It covers writing reliable code, defensive programming, the call stack window, and the locals and autos windows, with exercise files provided.

What people said

Recommends ZerosAndOnes · 2018-03 · Stack Overflow · on “Index was outside the bounds of the array when use random c#”

In Visual Studio you check the values through the debugger [this video] start from 03:00. I can explain it here, but I believe it's explained really well and in detail over there. The version might be different, but doesn't matter much. Regarding the places due to which QuestionPool might be empty please check my updated answer.

Recommends Igby Largeman · 2018-06 · Stack Overflow · on “Reading text file with reaping pattern c#”

Hi Monika. Your question indicates that you have a bug (error) in your code. StakOverflow isn't aimed at getting help with finding bugs. I recommend you learn about debugging by googling "debugging c# code", for example. If you are using Visual Studio, this video may help. [this video]

Recommends Igor · 2019-03 · Stack Overflow · on “c# Custom Exceptions”

I recommend you take a step back and learn how to debug your code at run time. Here are a few of the many resources available: Navigate through code with the Visual Studio debugger [LINK] , Learn to debug C# code using Visual Studio [LINK] , and Debugging C# Code in Visual Studio | Mosh [this video] .

Recommends Igor · 2019-03 · Stack Overflow · on “moving every int in the array one place backwards”

I recommend you take a step back and learn how to debug your code at run time. Here are a few of the many resources available: Navigate through code with the Visual Studio debugger [LINK] , Learn to debug C# code using Visual Studio [LINK] , and Debugging C# Code in Visual Studio | Mosh [this video] .

Recommends Igor · 2019-03 · Stack Overflow · on “How to add multiple data within a list?”

(*once you get your app to compile*) - I recommend you then learn how to debug your code at run time. Here are a few of the many resources available: Navigate through code with the Visual Studio debugger [LINK] , Learn to debug C# code using Visual Studio [LINK] , and Debugging C# Code in Visual Studio | Mosh [this video] .

Recommends Igor · 2019-05 · Stack Overflow · on “Why Im falling trough the plane?”

I recommend you take a step back and learn how to debug your code at run time. Here are a few of the many resources available: Navigate through code with the Visual Studio debugger [LINK] , Learn to debug C# code using Visual Studio [LINK] , and Debugging C# Code in Visual Studio | Mosh [this video] .

Recommends Igor · 2019-06 · Stack Overflow · on “How to fix Join(" ") doesnt add a space to the concatenated string”

About learning how to debug your code at run time: Here are a few of the many resources available: Navigate through code with the Visual Studio debugger [LINK] , Learn to debug C# code using Visual Studio [LINK] , and Debugging C# Code in Visual Studio | Mosh [this video] .

Recommends Igor · 2019-08 · Stack Overflow · on “Getting NullReferenceException but object is not null”

I recommend you take a step back and learn how to debug your code at run time. Here are a few of the many resources available: Navigate through code with the Visual Studio debugger [LINK] , Learn to debug C# code using Visual Studio [LINK] , and Debugging C# Code in Visual Studio | Mosh [this video] . put some break points on assignments so you can figure out at what point a null value is being assigned.

Recommends Igor · 2019-10 · Stack Overflow · on “Array Splitting Scenario”

Here are a few of the many resources available: Navigate through code with the Visual Studio debugger [LINK] , Learn to debug C# code using Visual Studio [LINK] , and Debugging C# Code in Visual Studio | Mosh [this video] .

Recommends Igor · 2020-05 · Stack Overflow · on “How does the foreach loop and if condition work?”

Here are a few of the many resources available: Navigate through code with the Visual Studio debugger [LINK] , Learn to debug C# code using Visual Studio [LINK] , and Debugging C# Code in Visual Studio | Mosh [this video] .