Visual Studio Immediate Window - Lambda Expressions Aren't Allowed - Is there a Work-around or Alternative? [closed]
Asked Answered
C

1

53

I'm debugging some tricky generic List-based code in VS 2010 - lots of hierarchy-processing etc.. Of course lambda expressions and anonymous methods aren't permitted within the immediates window and I can't be doing with stepping thru the code in the usual way as I'm still trying to get my head around the hierarchies ...

Can anyone suggest a workaround or an alternative tool?

Chaves answered 10/12, 2010 at 13:3 Comment(4)
Welcome to the Linq-hungry/Linq-loving world.Pentylenetetrazol
Off-topic apparently, despite 40+ upvotes and being favourited 10 times...Chaves
I use Enumerable Debugger Visualizer while debugging linq queries to compensate this inability up to some extent.Silage
@5arx This is an upcoming feature of VS2015Sailesh
M
16

At times like this I always turn to the most excellent LINQPad.

The front page of the linked site (at time of writing) immediately jumps in with stuff about SQL but don't let that obscure how powerful and flexible this tool really is. I sort of treat it like an Immediate Window on steroids. I find it invaluable for working my way through complex LINQ queries.

If you can live without intellisense it's free (the intellisense version is chargeable).

Megillah answered 7/12, 2012 at 15:13 Comment(8)
I use it pretty much everyday. It is an amazing tool. Actually, 'tool' doesn't do it justice.Chaves
I have to agree that for many cases, LINQPad is a good workaround.Septilateral
I understand this is good for snippets, but what if you are at a breakpoint and want code to run in that context? Is there away to attach LINQPad to the current debug context to use as an immediate window?Dyspeptic
Yeah, I have the same question as @DyspepticSihunn
Do you have to be hooked up a database? or can I mock data by defining an array or something?Parton
....What if I just want to use LINQ on code and not a database?Hogen
You don't have to be hooked up to a database. You don't even have to be using linq, despite the product name. It's just an excellent general sketchpad for.net code.Megillah
@Hogen - you can user your own data access assembly with Linqpad - just add it as an additional reference (in Linqpad: Query > Properties ...)Chaves

© 2022 - 2024 — McMap. All rights reserved.