JetBrains Rider 2024.3 Help

Debug multi-thread and async applications

Multithreaded applications are always harder to debug as you have to track multiple threads at a time. Moreover, multithreaded applications introduce new types of bugs and performance issues like uneven workload distribution, lock contention, serialized execution, and other*.

The illusion of a sequential flow you get from stepping in a debug session does not help while debugging a multithreaded app and can be misleading. When investigating issues that can be concurrency bugs, you should rely more on breakpoints rather than on sequential stepping. For example, conditional breakpoints can help you a lot if you want to focus on just one thread: just use some unique property of your thread (for example, thread ID) to trigger the breakpoint; data breakpoints will break the execution when a marked property of a specific object changes by any thread.

JetBrains Rider provides the following functionality to simplify the debugging of multithreaded and async applications:

  • In the Debugger tab of the Debug window, the left pane shows all threads of the application, and the next pane lists all stack frames of the selected thread:

    JetBrains Rider: debug frames select thread
  • The Parallel Stacks tab of the Debug window simplifies threads analysis by showing threads and their stack frames as a diagram.

  • The Tasks tab of the Debug window helps you get detailed information about the state of System.Threading.Tasks.Task and ValueTask objects in the current execution point of the application .

  • The ID of the current thread is shown in line with the current execution point in the editor.

Last modified: 25 June 2024