JetBrains Rider 2018.1 Help

Debugging Exceptions

Exception is an error that occurs in runtime and typically breaks normal execution flow. JetBrains Rider allows you to effectively debug application exceptions: you can explicitly tell the debugger to suspend the program execution when any unhandled exception or an exception of a particular type is thrown. JetBrains Rider stops the execution right after the exception occurs (before any exception handling is run) allowing you to examine program's stack frames.

Debugging unhandled exceptions

JetBrains Rider can break program execution when an unhandled exception is thrown and display the exception popup with the basic info about the exception at the code line that caused this exception. You can continue running the program, or explore more details in the Exception details tool window:

By default, JetBrains Rider does not break at unhandled exceptions. To enable this, select Break on user-unhandled exceptions (.NET/.NET Core only) on the Build, Execution, Deployment | Debugger page of JetBrains Rider settings (Ctrl+Alt+S).

Exception breakpoints

To debug an exception of a particular type, you should create a special exception breakpoint. Unlike line breakpoints, exception breakpoints are assigned not to a certain line of code, but to a certain exception type (e.g., in case of C#, it can be any type inherited from the Exception type).

To add an exception breakpoint

  1. Do one of the following:
    • Choose Run | Stop On Exception from the main menu.
    • In the Breakpoints dialog (Ctrl+Alt+B or Run | View Breakpoints... ), click new and select .NET Exception Breakpoints in case of C# or JavaScript Exception Breakpoints in case you debug a script written in JavaScript.
  2. In the opened dialog, enter the desired exception type name and click OK. The breakpoint is added to the list of breakpoints under .NET Exception Breakpoints or JavaScript Exception Breakpoints in the Breakpoints window.
    debug new exception breakpoint
  3. Specify breakpoint properties. Note that if Just my code is enabled, the debugger will suspend the program only in case the exception is thrown by the user code.

Now, once the exception of the specified type is thrown, the debugger suspends execution.

debug exception stack trace

Last modified: 20 August 2018