dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.12k stars 4.04k forks source link

Provide Linq evaluation of collections in Immediate window and Quick Watch #57585

Open vsfeedback opened 3 years ago

vsfeedback commented 3 years ago

This issue has been moved from a ticket on Developer Community.


Currently, it's utterly cumbersome to manually find and examine items in a large array. So I'm looking for an option to be able to create a Linq query in the Immediate window (or in Quick Watch), enabling me to filter the array and find the items I'm looking for in the result set quickly.

I remember that in VBA it was possible to create immediate ForEach blocks in the Immediate window while the debugger was halting at a breakpoint.

I'd expect such feature in the Immediate window and in Quick Watch, too.


Original Comments

Feedback Bot on 10/18/2021, 02:08 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

sharwell commented 3 years ago

@tmat This is already supported right? https://devblogs.microsoft.com/devops/support-for-debugging-lambda-expressions-with-visual-studio-2015/

tmat commented 3 years ago

Yes, however it doesn't always work well. E.g. if you are in a context of a source file that doesn't have using System.Linq; the EE won't see LINQ extension methods. Also both watch window and immediate window are limited to single line expressions.

bugarinov commented 2 years ago

A workaround is to use the LINQ methods directly i.e.:

System.Linq.Enumerable.First(myEnumerable, x => x.property.Equals("someValue"))

which returns

{myEnumerableType}
    property: "someValue"
PsykomantaBrain commented 7 months ago

A workaround is to use the LINQ methods directly i.e.:

System.Linq.Enumerable.First(myEnumerable, x => x.property.Equals("someValue"))

which returns

{myEnumerableType}
    property: "someValue"

This doesn't work for me either... The immediate window doesn't like the lambda expression.