SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Matt Ward


With SharpDevelop you can debug your code without leaving the development environment.

Setting Breakpoints

Position the cursor on the line where you want your breakpoint to be located, then click in the left hand margin of the text editor to create the breakpoint. This puts a breakpoint icon Breakpoint icon in the margin and highlights the line in red.

Breakpoint added to text editor

Alternatively you can select Toggle Breakpoint from the Debug menu or use the keyboard shortcut F7.

Toggle breakpoint menu item

To remove the breakpoint simply click the breakpoint icon or select Toggle Breakpoint from the Debug menu.

Running the Debugger

To run your program under the debugger select Run from the Debug menu.

Debug run menu option

Your program will then be started and SharpDevelop will change the window layout of the development environment as it switches to the Debug Layout.

To stop the debugger either let your program exit or select Stop process from the Debug menu.

Stop process menu option


When a breakpoint is hit your program will be paused and the next line to be executed is highlighted in yellow.

Breakpoint hit

Whilst the program is paused you can execute the code line by line using the Debug menu items.

Debug menu after breakpoint hit

Step into will call the method on the current line and stop at the first line of code inside the method.

Step over will execute the entire method on the current line but it will not step into it.

Step out will finish executing the current method and returns to its parent method.

Continue debugging will continue the program execution so it is running just as it was before it was paused.

You may also want to skip over lines of code whilst you are debugging or even to re-execute the same lines of code again. In the text editor select the line of code you want to execute next, right click and select Set current statement.

Setting the current execution statement

The selected line will then be highlighted in yellow and will be the next line of code executed.

Whilst the program is paused you can view the current state of variables and objects in order to diagnose problems. This is covered in the following sections.

Data Tips

If you move the mouse over a variable SharpDevelop will display a special tooltip called a data tip.

Data tip window

Data tips show more information than ordinary tooltips, allowing you to explore an object's members. To see its members expand the data tip by clicking the plus icon Plus icon to expand a data tip.

Data tip window expanded

Local Variables

The Local Variables window allows you to browse variables defined in the function currently being executed, arguments passed into the current function, fields and properties of the class where the function is defined.

From the View menu select Debug and then Local variables.

View local variables menu option

The Local Variables window is then displayed.

Local variables window


The Callstack window shows you the method calls currently on the stack.

From the View menu select Debug and then Callstack.

View call stack menu item

The Callstack window will then be displayed.

Call stack window

< previous | home | next >

Published Jul 05 2006, 11:53 AM by MattWard
Filed under:


No Comments
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this ( email address.