Debugging

This topic shows the debugging capabilities of Radzen Blazor Studio. When you debug your Blazor application you run it with a debugger attached. Debugging allows you to see how your application behaves at runtime. You can step through your code and inspect the values of properties, fields and variables. You can also examine the execution path by stepping in and out of methods.

Note: Debugging is a premium feature introduced in v1.4.0.

How-to video

Start the debugger

To debug your Blazor application you need to start it with the debugger attached:

  • Press F5 (or use the Run > Start Debugging menu option, or click from the Run split button).

Radzen Blazor Studio will build the application and run it with a debugger attached (if the there are no build errors of course).

The application will execute until it reaches a breakpoint or unhandled exception.

Start debugging and set a breakpoint

To stop debugging:

  • Press SHIFT+F5 (or use the Run > Stop Debugging menu option, or click ).

Note: Debugging WebAssembly applications requires a specific browser to be installed - either Google Chrome or Microsoft Edge. Radzen Blazor Studio prefers Google Chrome if both browsers are installed.

Breakpoints

Breakpoints tell the debugger to stop at a specific line of code. When the debugger is stopped at a breakpoint you can inspect the variables available in the current scope either from the Variables pane or by hovering them in the code editor.

To add a breakpoint:

  1. Open the file in split or source edit mode.
  2. Click just before the line number (or put the cursor at the line of interest and press F9).

You can add breakpoints before or after starting the debugger. Breakpoints are supported in C# code only - in .cs and .razor files.

Breakpoints Pane

The Breakpoints pane shows all breakpoints in the application. You can disable breakpoints or remove them. The debuger will not break if it reaches a disabled breakpoint.

You can also configure the debugger to break on unhandled and or all exceptions.

Debugging your code

When the debugger reaches a breakpoint it will stop the application and focus Radzen Blazor Studio. You can then use the debugging tools to step through the execution path.

Step into

Press F11 (or click ) to step inside a method call. The debugger advances in the first line of the method.

Step over

When you are on a line of code that is a method call, you can press F10 (or click ). This advances the debugger without stepping into the method (the code still executes).

Step out

To advance the debugger out of the current method press SHIFT+F11 (or click ). The debugger will go back to the code that called that method.

Continue debugging

To continue the app execution press F5 (or click ). The application will run intil it reaches a breakpoint.

Troubleshooting

Debugging does not start due to files being locked

Make sure you are not debugging the application with other tools (e.g. Visual Studio) or the application isn’t already running. Try restarting Radzen Blazor Studio.

WebAssembly debugging does not start if there is a browser instance already open

WebAssembly debugging relies on the remote debuging feature of Google Chrome or Microsoft Edge. This feature requires Radzen Blazor Studio to start a new browser process. Google Chrome and Microsoft Edge however keep only one instance thus prohibitting remote debugging. Close all browser instances and try to start the debugger again.

The application is not launched with my default browser

WebAssembly debugging requires Google Chrome or Microsoft Edge. Radzen Blazor Studio will use your default browser when you start the application without debugging or if the application is Blazor Server.