VS2015 Preview: Debugger support for lambdas and LINQ

If you’ve ever tried running a lambda expression in the Immediate Window or as a Watch, you’ll be pretty familiar with the response, “Expression cannot contain lambda expressions” (shown below in VS2012). If you try LINQ, you instead get “Expression cannot contain query expressions”, which is no better.

vs2012-lambda-immediate-window

This changes in Visual Studio 2015, which adds debugger support for lambda expressions and LINQ. VS2015 happily runs lambdas in both the Immediate Window and as Watches:

vs2015-lambda-immediate-window

LINQ works just as happily:

vs2015-linq-immediate-window

So there you go: another much-anticipated and extremely useful feature coming in Visual Studio 2015.

VS2015 Preview: XAML Peek

In Visual Studio 2015 Preview, you can now peek and edit definitions from XAML. Let’s take a look at some examples from Lilly Notes, a WPF application I built upon WPF MDI.

You can Peek Definition in your XAML editor via a context menu when right-clicking, or by pressing Alt+F12:

vs2015-xaml-peek-context-menu

If you do that on an event handler, you can peek into the event handler’s definition in the codebehind, without ever leaving your XAML:

vs2015-xaml-peek-edit

For more extended editing, you can “Promote to Document” (see screenshot above) to open the actual code file.

If you have an ElementName binding, you can peek into the definition of the target element, as you can see below with ToggleEditTitleButton:

vs2015-xaml-peek-elementname

XAML Peek also works pretty nicely with resources, which may be scattered about your project. For instance, I’m using this BoolToHiddenConverter as a StaticResource. I can peek its definition in the UserControl’s Resources section:

vs2015-xaml-peek-resource2

As it turns out, I can also peek the resource’s type (in this case BoolToVisibilityConverter), to edit the converter directly:

vs2015-xaml-peek-resource

No doubt this feature will be pretty handy for those writing some of the larger WPF or Windows Phone 8 applications.

VS2015 Preview: Unused usings/imports

Another of the IDE enhancements you’ll find in Visual Studio 2015 Preview is that unused using directives (C#) or imports (VB .NET) will appear in a less prominent colour, to distinguish them from the usings/imports that are actually used.

vs2015-unused-usings

You can see an example of this when creating a new WPF application (screenshot above), since most of the usings provided by default in the codebehind are useless until you require specific WPF features.

vs2015-remove-unused-usings-preview

That’s not all, however. On the side, you’ll find a light bulb that will suggest remedial actions. In this case, it’s suggesting that you remove the unused usings. When you hover over this action, you actually get a preview of what your code will look like.

You’ll see more of this paradigm of suggested actions and live previews as I continue to cover the new features in Visual Studio 2015 Preview.

VS2015 Preview: Coloured Tooltips

Visual Studio 2015 brings a wealth of IDE enhancements. One of these is an improvement to the user experience of tooltips thanks to the addition of a touch of colour.

For instance, here’s what you get when you hover over a type:

vs2015-new-type-tooltip

…and this is the tooltip you get from intellisense:

vs2015-new-intellisense-tooptip

How about this tooltip showing a preview of a collapsed method:

vs2015-new-collapsed-tooltip

Or this tooltip showing a preview of XML documentation:

vs2015-new-xmldoc-tooltip

So that’s a nice touch of colour in several different tooltips.

Not impressed? Let’s take a look at what these looked like in Visual Studio 2013:

vs2015-old-type-tooltipvs2015-old-intellisense-tooptipvs2015-old-collapsed-tooltipvs2015-old-xmldoc-tooltip

OK, so you’ll realise that this new feature in Visual Studio 2015 won’t change your life, but it’s a great improvement in user experience from what we had before.