Setting a breakpoint

Breakpoints allow us to mark a line of code that we want to pause at to find bugs. Click on the open curly brace at the beginning of the Main method and press F9.

A red circle will appear in the margin bar on the left-hand side to indicate that a breakpoint has been set, as shown in the following screenshot:

Breakpoints can be toggled with F9. You can also left-click in the margin to toggle the breakpoint on and off, or right-click to see more options, such as remove, disable, or edit the breakpoint.

In Visual Studio 2017, go to Debug | Start Debugging, or click on the Start toolbar button, or press F5.

In Visual Studio ...

Get C# 7.1 and .NET Core 2.0 – Modern Cross-Platform Development - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.