Ranorex Help Center

How can we help you?

Debugging

Ranorex provides the possibility to debug code directly in the development environment.

To enable the debugger press the 'Enable Debugging' button in the toolbar.

Enable Debugging

Enable Debugging


To make the Debugger stop at a specific position in your code, you can set breakpoints.
Breakpoints can either be set
  • by clicking on the left margin at the line you want to set it, or
Add breakpoint

Add breakpoint


  • by putting the cursor to the line you want to add a breakpoint, open the 'Debug' menu an choose 'Toggle Breakpoint'.
Toggle breakpoint

Toggle breakpoint


By setting a breakpoint, a red circle will be added at the margin and the line of code will be highlighted red. The breakpoint can be removed in the same way as it has been added.

After setting a breakpoint the debugger can be started by executing your application as described in the chapter Run.

Note  To run an application with debugger, it's necessary to not choose 'Run without Debugger' from menu.


The application will start and Ranorex Studio will switch to the 'Debug Layout' which causes the following menu items to be available from 'Debugger' menu and toolbar:


Continue Debugging Continues execution

Stop Process Forces the process to stop

Step Over Executes the statement on the current line but it will not step into

Step Into Executes the statement on the current line and stops at the first line of code inside the method

Step Out Finishes executing the current method and returns to its parent method
Debugging menu Items

Debugging menu Items


Debugging toolbar items

Debugging toolbar items


To skip several lines of code and continue debugging on a specific line, the context menu item 'Set Current Statement' can be chosen by right-clicking on the line and choosing 'Set Current Statement' from the context menu.
Context menu 'Set Current Statement'

Context menu 'Set Current Statement'


In paused mode, the actual state of the individual objects can be diagnosed.

The following windows can be activated in the sub-menu 'Debug' which is part of the 'View' menu.

Debug sub menu

Debug sub menu

Callstack Shows method calls currently on stack.
Local Variables Shows variables defined in the function currently being executed, arguments passed into the current function and fields and properties of the class where the function is defined.
Watch Shows all expressions added to the watch list. Expressions can be added by right-clicking on the window, choosing 'Add' from context menu and entering the expression. Expressions can also be added by selecting them in code and dragging them into the 'Watch' window.
Additionally to the different views it's also possible to diagnose individual objects directly in code using the tool tips popping up when moving the mouse over them.
Tool tip

Tool tip


Note If Visual Studio 2010 is installed on the machine running Ranorex Studio, debugging might be slow. To overcome this issue it is recommended to search the key 'LowLevelHooksTimeout' in the registry and delete all occurrences.