I suggest you ...

Enable step-through debugging in fluent method chains

Fluent syntax is becoming a bigger and bigger part of C# with every release (LINQ and expression-bodied members being two prime examples). However, the debugging experience for fluent syntax is absolutely terrible. If I have a method chain like this

var result = mySource
.Foo(x, y)
.Bar(z)
.Baz();

and I need to examine the intermediate result of Foo that is passed to Bar while debugging, I must refactor my code into a more imperative syntax:

var temp1 = mySource.Foo(x, y);
var temp2 = temp1.Bar(z);
var result = temp2.Baz();

The same applies to expression-bodied members, which must be converted back to block-bodied members, with breakpoints on their return statements.

This creates a conflict of interests between having concise code written in the functional style with minimal assignment statements, and being able to debug. In my experience, this results in repositories with mixed code conventions, which is the worst of both worlds.

If Microsoft is continuing to invest resources in making C# more of a functional language, the debugging experience should support this style.

13 votes
Vote
Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
You have left! (?) (thinking…)
James Faix shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

0 comments

Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
Submitting...

Feedback and Knowledge Base