roslyn icon indicating copy to clipboard operation
roslyn copied to clipboard

Provide Linq evaluation of collections in Immediate window and Quick Watch

Open vsfeedback opened this issue 4 years ago • 4 comments

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.

vsfeedback avatar Nov 04 '21 20:11 vsfeedback

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

sharwell avatar Nov 11 '21 00:11 sharwell

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.

tmat avatar Nov 11 '21 00:11 tmat

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"

bugarinov avatar Nov 26 '22 00:11 bugarinov

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.

PsykomantaBrain avatar May 04 '24 02:05 PsykomantaBrain