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 AltEnter and choosing the corresponding action:
![https://resources.jetbrains.com/help/img/rider/2024.3/run-static-method.png](https://resources.jetbrains.com/help/img/rider/2024.3/run-static-method.png)
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.
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 CtrlAltShift0R and then press 00.
In the Run/Debug Configuration dialog, click Add New Configuration
Ctrl0N, choose the .NET Static Method configuration type, and specify a name that will help you identify this configuration in the future.
Optionally, adjust the common settings of the configuration and configure before launch tasks.
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
).