Immediate Window – Interact with your Code while Debugging in Rider
A valuable part of the debugging experience is experimentation, modifying variables and determining whether the outcomes were what we expected. With the latest release of Rider 2020.3 EAP, we’re happy to give developers more tools that make debugging more effective.
As you may have guessed from the title of this post, the Immediate Window is shipping in Rider 2020.3 EAP.
What is the Immediate Window?
The immediate window offers a way to access the code of our application while it is being executed. While debugging, we can write additional code that can add to or alter the current code execution. Rider’s Immediate Window has many of the same code editing features that we use regularly when developing. We can evaluate expressions, execute statements, print variables, and much more. Let’s take a look at some of those features now.
Using the Immediate Window
The Immediate Window becomes visible as soon as we start a debugging session. We can see the new window on the bottom-right, below the watch variables within the debugger pane.
We can toggle the Immediate Window by clicking the little terminal icon, which is right below the “show watch variables” icon (the glasses).
The Immediate Window will only accept input when the application is in a paused state, likely due to hitting a breakpoint. Once the window becomes active, we can type any valid C# code, with the full range of code completion features to assist us.
We can also use shortcuts like
Alt+Enter to trigger refactorings.
It is also possible to navigate from from the Immediate Window to classes and variables.
In the following example, we alter the value of
2. Note that the Immediate Window understands the execution context. Being paused in the current scope allows us to access the local variable.
In addition to being able to access previously defined members, we can also define new synthetic variables. In the following example, we instantiate a new instance of a
Person class. When we create a new variable, Rider will track its value in the variables window under a synthetic variables collection. We can inspect, pin, and alter these variables under this new category like we would any other variables.
We’ve discussed how to adjust existing variables and create new ones for Rider to track. We can also execute statements without needing to assign them to any variables. Rider will record the last returned value from a run statement under the $result placeholder.
The Immediate Window will also track the history of all of our statements. Pressing the up and down arrow keys will cycle through all the statements we’ve executed in the Immediate Window.
To give the Immediate Window a try, you can download the latest version of Rider 2020.3 EAP.
We hope you enjoy using all the new features shipping with Rider, especially the Immediate Window. Remember to leave comments on this post or file issues in the Rider issue tracker.
Subscribe to Blog updates
Thanks, we've got you!
The Developer Ecosystem in 2023: Key Trends for C#
We’ve captured insights from 26,348 developers worldwide in our annual Developer Ecosystem Survey 2023. This recap focuses on C# and .NET, but you can see what’s trending in other languages as well. Enjoy the results and commentary, and let us know what you think! Top Discoveries We know t…
The ReSharper 2023.3 Release Candidate Is Now Available
Get a preview of all the latest features and improvements set to be shipped with the next major ReSharper and .NET tools releases by downloading the Release Candidate builds that have just landed. Here are the major improvements in each of the new builds: The ReSharper 2023.3 Release Can…
The Rider 2023.3 Release Candidate Is Now Available
There’s only a few days left before the next major release for Rider! Don’t feel like waiting? Get a sneak peek of Rider 2023.3 now by downloading the Release Candidate build that has just landed on our website. The Release Candidate build contains all of the notable changes that we’ve introduc…
Primary Constructors – Using C# 12 in Rider and ReSharper
Welcome to our series, where we take a closer look at the C# 12 language features and how ReSharper and Rider make it easy for you to adopt them in your codebase. If you haven’t yet, download the latest .NET 8 SDK and update your project files! In this series, we are looking at: Primary …