Interactive debugging with Visual Studio
One of the most important debugging strategies is to use interactive debugging tools effectively. In this section, you will learn how to debug problems interactively at development time.
The menu commands for debugging are on the Debug menu in Visual Studio or the Run menu in Code and Rider.
Creating code with objects to view
Let’s explore debugging by creating a console app that references a class library, and we will then use the debugger tools in your code editor to step through and view objects live at runtime:
- Use your preferred code editor to add a new Class Library /
classlib
project namedDebugLibrary
to aChapter04
solution. - Modify
DebugLibrary.csproj
to statically importSystem.Convert
,System.Convert
, andSystem.Text.Encoding
for all code files and treat warnings as errors, as shown highlighted in the following markup:<Project Sdk="Microsoft.NET.Sdk"> <...