Basic debugging with Visual Studio 2019

Whenever we write the logic for software applications, there are times when we manage to achieve the intended functionality outright without any problems and errors. While it is often desirable to get it right the first time, this will most definitely not always be the case for most software developers.

We may have a situation where our code has compiled successfully but we find out that we don't have the output we wanted, or we may get compile-time or runtime errors. In this case, it is quite helpful for a developer to find the errors before anything is discovered after the software has been released.

Errors within an application are syntactical or semantical, in which you as a developer either haven't followed the prescribed language syntax or are not making logical sense. These kinds of error are easier to find. The Visual Studio IDE will help you to catch most of these development errors while downright refusing to compile or throw an exception after you run your applications in debug mode.

There is another set of application errors that arise from not being able to produce intended behaviors, even though we have done our best to code against the prescribed functionality. These are best counter-checked by writing unit tests and running them against our code. Some professionals within the software development industry advocate test-driven development (TDD), in which the tests are written before any functionality is written, while others may consider this a duplication of effort and are not so bullish about this. Whatever the case, unit tests are quite important in an application and we will spend some time later in the book, when we provide practical examples, demonstrating their worth.

The following screenshot is a snapshot of the debugging functionality that's available in Visual Studio 2019:

We will not be going through all of the debugging functionality that's available through the Debug menu shown in the preceding screenshot because this would take a whole book of its own, but it is well worth exploring as a developer. Knowing the basics of debugging will save you a lot of time as a developer. In the next section, we will explain a few of the most important debug items that are available to you in Visual Studio 2019.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.102.178