JetBrains Rider 2024.3 Help

Run and debug .NET static methods

In JetBrains Rider, you can execute any public static void method without parameters. This way, you can test specific algorithms or subsystems in your codebase without launching the whole application. If necessary, you can use console for interactive execution.

You can run a static method right from the editor by clicking in the gutter next to the method or pressing Alt+Enter and choosing the corresponding action:

JetBrains Rider: Running a static method from the editor

Everything executable in JetBrains Rider requires a run/debug configuration, and a static method is no exception — when you run it from the editor for the first time, JetBrains Rider creates a temporary configuration that you can save and reuse in the future.

Alternatively, you can add a configuration for a .NET static method in the Run/Debug Configurations dialog.

Create a run/debug configuration for .NET static method

  1. Open the Run/Debug Configuration dialog in one of the following ways:

    • Select Run | Edit Configurations from the main menu.

    • With the Navigation bar visible (View | Appearance | Navigation Bar), choose Edit Configurations from the run/debug configuration selector.

    • Press Alt+Shift+F10 and then press 0.

  2. In the Run/Debug Configuration dialog, click Add New Configuration Add New Configuration Alt+Insert, choose the .NET Static Method configuration type, and specify a name that will help you identify this configuration in the future.

  3. Optionally, adjust the common settings of the configuration and configure before launch tasks.

  4. Specify the method by choosing the containing project in the Project: selector and providing the fully-qualified method name in the Static method: field (that is, Project.Class.Method).

Last modified: 26 May 2024