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:
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
Open the Run/Debug Configuration dialog in one of the following ways:
Select
from the main menu.With the Navigation bar visible ( ), choose from the run/debug configuration selector.
Press Alt+Shift+F10 and then press 0.
In the Run/Debug Configuration dialog, click 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.
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
).