Extended Immediate Window for Visual Studio (use Linq, Lambda Expr in Debugging)This is a Package / Add In for Visual Studio 2008 (should also run in VS2005 I think) that provides something I call "Method Injection" which is basically allowing multiple statements, Linq statements and Lambda expressions to be inserted and executed at a certain position in a debugged program. Actually it appears as an additional Toolwindow for Visual Studio that behaves a lot like the well known "Immediate Window" but enables us to to a few additional quite cool things that arent possible with VS right now: 1. Have you ever tried to use a Linq Statement, Lambda Expression or Anonymous Type in the Immediate Window? It wont work, wich is quite annoying since they are some of the most usefull things you could use while debugging. For example you could write: myCars.Where(car => car.Manufacturer.Name == "Mercedes") and get the results). This AddIn enables you to do so and it already works (even though Intellisense doesent work) 2. When standing at a Breakpoint sometimes you might want to write multiline statements in the Immediate Window (for example writing a foreach iteration over some sort of collection). This AddIn is the only way I know you could do it at the moment. Actually it enables you to type everything someone could code within a Method and execute this batch of statements at the position the Breakpoint stands at. This is why I sometimes also call the AddIn "Intruding Methods" or "Injection Methods". Within this "injection method" you write you can of course also use the private and public accessible objects that are found at the position of the current breakpoint, just like you can in the immediate window. 3. Search the whole tree of properties and fields (the object graph) of a locally accessible object or the result of your "injection method" for some sub string. This is something i am greatly missing in the Watch-Toolwindow of Visual Studio, especially when I am working with new or unknown types. For example I tried to understand the skinning mechanism a component manufacturer provides for their controls (DevExpress), my goal was to get the checkbox image out of the skin so i could use it for my own things. Using this technique i found it quite easy since I could just take a few of the objects I suspected to contain the images somewhere deep inside and just searched the objects for "checkbox". From only knowing the object "myObject" of Type "SkinProvider" (or whatever) what I found might have been something like "myObject.SomeCrypticNameService.SomeOtherClass.FooBar.Images.CheckBoxImage" which provided what I was looking for. |