(Print this page)

New and enhanced debugging features of Visual Studio 2015
Published date: Sunday, May 24, 2015
On: Moer and Éric Moreau's web site

My December 2014 article listed a couple of new feature of VS2015. At the time of writing this, the current version of Visual Studio 2015 is the Release Candidate and it is a lot clearer what the final version will look like. I have played with it on a WPF project that will be delivered in the next few months.

Like every other iteration of this product, the debugger, which is an important piece for every developer, has been enhanced greatly.

No demo code this month

There is no downloadable demo code this month code. You will need Visual Studio 2015 in order to try the new features.

Notice that there might be some features reviewed here that will work differently in the final version of the tool.

Release date

You might wander when the final version will be released? I don’t have the exact answer to that question other than the official “summer 2015”.

Meanwhile, the SKUs have been announced in March as well as the prices. The SKUs have been simplified to 3 editions:

  • The Community edition is completely free if you satisfy the requirements.
  • The Professional edition.
  • The Enterprise edition (replacing the Premium and Ultimate edition of VS 2013).

You should visit the comparison chart if you want to know the differences between these editions.

Lambda debugging

So let’s starts with the first debugger improvement. Debugging lambda expressions from within watch windows or immediate window has always been a pain or just impossible to do. These debugging windows were simply spitting the “Expression cannot contain lambda expressions”. The new IDE now supports these expressions.

For example, after having executed the following statement, I was able to query my “results” variable right from the debugging windows as shown in figure 1 (or figure 2 for the C# version).

Dim results = Enumerable.Range(1, 5).Select(Function(i) i * 5).ToList()

Figure 1: Debugging lambdas (VB)

Figure 2: C# version of debugging lambdas with a small enhancement also showing the index

Actions on breakpoints

It has always been possible to add breakpoints to your code to stop the execution on a particular statement. Even conditions on these breakpoints were possible to prevent always breaking which was useful with loops for example. These features are still possible.

Something has been added to the breakpoints. The new feature is called Actions. This new feature simply output a formatted string to your output window containing the message you want. As you can see in figure 3, using string interpolation, we can write a full string putting your variable between {} and the string will be shown to the Output Window.

If you have a condition set, the action will only be triggered when the condition is through. If you don’t have a condition, the action will always be triggered.

Figure 3: Actions in action

This new feature will be very helpful in combination with the IntelliTrace improvements and the new Diagnostics Tools hub. Presented below here.

Perf Tips

When you step through code from using the debugger, you can now see how long the previous line (or group of lines) took to run as shown in figure 4. To see this timing, place a break point on a line of code (for which you want to see the time it takes) and hit F10 (to execute the line). When the next line gets ready to be executed, you now see a little tooltip showing how long it took (in milliseconds) to execute the last line.

Figure 4: Perf Tips

And if you click on that tooltip, it will open (if not already opened) the new Diagnostics Tools hub. This hub is collecting tips from many debugging helpers trying to show it on a time line. This hub is not just one thing, is a hub containing many debugging tools.

IntelliTrace now feed that Diagnostics Tools hub

I am not sure about all of the other new features but this one will require the Enterprise edition.

This is probably my favorite improvement to the debugger. How often I have experienced a strange behavior while debugging an application and wasn’t able to reproduce that behavior or just didn’t know what code just ran. Now thanks to IntelliTrace combined to the debugger, you can pause (using Break All) your code and view all the latest steps executed, all your debugger windows like the call stack and the watch window will show you the state at that point in time.

Angelos Petropoulos wrote a nice article showing how IntelliTrace is now integrated into that hub. This article can be read from here. If you prefer a video, the same guy, Angelos Petropoulos has the recording of a talk he gave at the //build conference on May 1st available from here.

If you pause the execution of your application and do not see the events you are expecting, chances are that the settings are not optimal for your needs. IntelliTrace consumes resources while debugging. The team that developed the tool identified a set of events that are traced by default. Depending on your type of application, you might want to review these settings to adjust them to fit your specific needs (as shown in figure 5).

Figure 5: IntelliTrace default settings

Figure 6: The new Diagnostic Tools hub

CPU and Memory Usage Tool

Added to the same Diagnostic Tools hub we just discussed, the same window can also help you debug memory leaks and discover CPU spikes.

These features are not easy to explain. You need to see it to better understand them. Channel 9 has a good video demonstrating how to find memory leaks in your application by using the memory usage tool. This video is available from here.

Live Visual Tree & Live Property Explorer

These 2 new features are for WPF developers only. They can be used to inspect the visual tree of the currently running WPF application and the properties of the selected element in the tree. You select an element in the tree and you can inspect and modify its properties in the Explorer.

These 2 features are available under the Debug->Windows menu.

In addition to view the properties, you can add new ones. For example, in my demo application, the Background property of the button was not set. I clicked the New button, selected the Background property and I was able to set the value to Red (see figure 7). All this without having to stop and restart the application.

Apparently, Microsoft is working to support these same features for Windows Store apps but no date has been announced yet.

Figure 7: Adding a property at run time

Conclusion

I have introduced you to some of the best enhancements regarding the upcoming VS2015 debugging features that will surely make your job easier.

These features will be built-in. if you add other tools on top of this like Oz-Code which has been revamped for Visual Studio 2015 with some great features too, I am pretty sure you will write bugs just for the sake of testing the debugging!


(Print this page)