Debugging Basics
Prerequisites: Comments & code style
Like Java, C# separates compile-time errors (caught by the compiler before anything runs) from exceptions (thrown while a successfully compiled program is running):
Unhandled exception. System.IndexOutOfRangeException:
Index was outside the bounds of the array.
at Program.Main() in Program.cs:line 4
Visual Studio's and VS Code's debuggers both let you set breakpoints and step through code, inspecting variables at the exact moment something goes wrong — the same workflow as Java's IDE debuggers.