Posted by Filip Ekberg on November 15 2013 1 Comment
With Visual Studio 2013 being publicly released I think it’s time I show off one nice improvements in Visual Studio 2013.tudio 2013. There are in fact a lot of nice improvements in Visual Studio 2013 and one of my favourite ones, actually two of my favourite ones are the debugging improvements of asynchronous code and the information that we are given about for instance how many references there are to our method(s).
You’ve been able to see the current executing threads for a while now in previous versions of Visual Studio, but now you can see a breakdown of the current tasks that are being executed. While you are debugging your application you can go ahead and open up the new
Tasks window. Without having to navigate yourself around the endless menus in Visual Studio, you can go up to the right corner (don’t click the X!) and type
Tasks in the search box, you should see something like the following:
I put together a fairly simple code snippet to show some data in the new window that we have access to in order to get improved information about the running tasks and the sample looks something like this:
public async Task ExecuteAsync()
var tasks = new
Task.Run(async () =>
Notice that the method doesn’t really return anything but it’s best practice to return a
Task instead of
void, I recently did a talk on why that is so if you want to know that go and have a look! Another thing to notice is that I follow the method naming convention and appending the word
Async to the method name.
Alright, let’s go back to the window that we are looking for now, I set a breakpoint, told Visual Studio to start a new debugging instance and this is what I get now:
Tasks window gives us tons of important information such as:
- Task Id
- Start time
- Where the code is located
- What task it is (notice the state machine for the async method)
If you find yourself writing a lot of asynchronous code, this will be really helpful!
Do you have a favourite feature of Visual Studio 2013 yet or are you stuck at an older version of Visual Studio and miss some of the new features? I’d love to hear your comments!