Introduction
As developers, part of our job is to find and remove errors…
Such errors generally fall into 3 major categories:
Syntax Errors
Runtime Errors
Logic Errors (also called bugs)
Finding errors is called Debugging.
This job can be quite difficult.
This helps you to remember the available Members / Methods for a Class.
IntelliSense (cont.)
IntelliSense also provides help in calling Methods:
2. A Tool-Tip Parameter list for called Methods…
Which appears when you type the parentheses for a Method call.
Listed information includes:
Parameter Number and Types, and Return Type
General description of parameters
A Drop Down list of selectable choices for the parameter (not all may be valid…)
This helps remember and set the parameters for available Methods.
Note: For overloaded Methods, the menu lists available Method versions…
Allowing you to choose which Method version to use.
Runtime Errors
Runtime errors occur during Program Execution…
Due to unexpected behavior while running…
Causing the Program to Fail during operation;
Providing the user with little explanation or choice.
Typical examples :
Hard-disk error
Loss of connection error (Internet)
Database or Server Error, etc
Here, we have ( 日本語 ): ‘Object reference not set to an instance of the object’,
Logic Errors
Occur when the developer does not fully understand his code.
In this case, the program may yield incorrect results or behavior…
Even though all of the Syntax is correct (Hard to Spot!).
Typical examples :
An Infinite Loop (a loop that never stops looping; see example below)
Improper Branching (e.g., incorrect If-Then logic)
A comparison operation which does not yield the expected result.
This allows us to run normally up to our ‘point of interest’ and then stop...
So we may step through the code (line-by-line) from there, to find the error.
Breakpoints are usually added while writing code…
But can also be added while a running program is waiting for user input.
Note: Debugging tools are available with the Build Configuration set to Debug
…But not Release.
We also learned to use some .NET debugging tools for catching bugs:
Setting Breakpoints
The Breakpoints Window