Lambda expression breakpoints and debugger watches in Rider
Rider comes with a powerful debugger for .NET (and JavaScript) which can be attached to a new or existing process. It lets us place breakpoints to pause the application and inspect variables, the current call stack and so on. In Rider 2017.2, we’ve added several features to make debugging with lambda’s more enjoyable.
Note: make sure to check out our series about Rider’s debugger!
Lambda expression breakpoints
When placing a breakpoint on a line with multiple statements, for example where one is a lambda expression, Rider will ask us whether we want to pause program execution on the entire statement, or just on the lambda:
When we then start the debugger, Rider will break on every execution of the lambda (tip: for large collections you may want to look into dependent breakpoints). This allows us to inspect variables within the lambda’s context:
Lambda expressions in debugger watches
Rider’s debugger now provides support for lambda expressions when adding Watches (Alt+Insert).
Depending on the underlying type, this may execute a database query or enumerate an IEnumerable
. Once the debugger evaluates and executes the expression, it visualizes the results:
Download Rider and give it a try! We’d love to hear your feedback.
Dev says:
October 30, 2017Do you plan to eat into Oz-Code’s features? I have to say Rider looks quite good, if I ever become rich I will buy a personal licence!
Tom says:
October 30, 2017You will convert me at once if data breakpoint are supported.
Marcel Bradea says:
November 13, 2017@Dev Rider’s not expensive, the pricing is very sensible.
If you were to ever become rich – you may just buy a Visual Studio licence! (and then realize Rider is quickly becoming a better/faster IDE) – though not quite all the way there yet 🙂
M says:
January 9, 2018It doesn’t seem possible to set a breakpoint inside an inline Action or Func that is passed as a parameter.
However, if you put a breakpoint in a classic method or function called by said inline Action or Func, you can then continue to step into your Action or Func for the remaining code after the call to said classic method.
Am I missing something?
Maarten Balliauw says:
January 10, 2018You mean something like this?
That should work fine when debugging. If not, would you have a minimal repro we can look at?
M says:
January 10, 2018Hi Maarten,
Your example works for me in 2017.3. However, Rider won’t let you add a breakpoint if it’s an expression body.
Maarten Balliauw says:
January 10, 2018That’s a good find! I just logged an issue for you here: https://youtrack.jetbrains.com/issue/RIDER-12656
M says:
January 10, 2018Thanks Marteen!