
A debugging tool can take you to the exact place in your code where the exception occurred and can help you investigate possible fixes.

If you run into an error (exception) while running your app, that can be a good thing! An exception is an unexpected event encountered when running code, typically an error of some kind. We expect that you already ran into a problem in your code, otherwise you wouldn't be here trying to figure out how to debug it! So, before you start debugging, make sure you've identified the problem you're trying to solve: It helps to clarify the problem that you ran into before you try to fix it.

Clarify the problem by asking yourself the right questions In this article, we introduce the core principles of debugging and provide tips to get you started. Using a debugger effectively is also a skill that takes time and practice to learn but is ultimately a fundamental task for every software developer. You then understand what corrections you need to make in your code and debugging tools often allow you to make temporary changes so you can continue running the program. Debugging means to run your code step by step in a debugging tool like Visual Studio, to find the exact point where you made a programming mistake. Sometimes it does something completely different! When this happens, the next task is to figure out why, and although we might be tempted to just keep staring at our code for hours, it’s much easier and more efficient to use a debugging tool or debugger.Ī debugger, unfortunately, isn’t something that can magically reveal all the problems or “bugs” in our code. Without fail, the code we write as software developers doesn’t always do what we expected it to do. Applies to: Visual Studio Visual Studio for Mac Visual Studio Code
