Unfortunately bugs are a part of software development, and despite our best efforts to write software correctly from the start we spend a lot of time in the debugger. While bugs are an unfortunate fact of life, finding them doesn’t have to be as painful as it often is. For you problem-solvers out there, the Visual Studio 2015 debugger contains a rich set of features that can really increase your productivity…assuming you know they exist, and how to use them! To help with you learn more about our debugging tools, I recently gave three talks on “Debugging Tips and Tricks for .NET developers”, at Microsoft’s Build Conference (60 minutes), at Microsoft’s Ignite Conference (75 minutes), and most recently on Visual Studio Toolbox (38 minutes). So check them out!
For the folks who like the printed word more than talking heads, I’ll also cover some of the highlights I hit on in the talks. These tips include both new features in Visual Studio 2015 as well as useful functionality from previous versions of Visual Studio.
Note: If you are interested in watching one of the talks, all three talks use the same demos and cover similar content, where the shorter talks are simply more selective about which features they show.
Start Debugging
While most debugging sessions begin with “Start Debugging”, there are other options as well:
-
Need to start debugging at the entry point of the application? Use “Step Over” (F10) or “Step Into” (F11) when in design mode and it will take you to the entry point of the application (assuming Just My Code is enabled) eliminating the need to find the line of code in the correct source file to place the breakpoint on.
-
No code edits to make at design time? Restart debugging allows you to quickly restart your application with debugging enabled. This eliminates the need to click “Stop Debugging”, then wait for the IDE to return to design mode, and THEN click “Start Debugging” again.
-
Need to start multiple projects in your solution? Configure your solution for multiple startup projects, to launch multiple projects with (and/or without) debugging. This is particularly useful when debugging a solution that contains applications that depend on each other at run time (e.g. a client and server).
Execution Control
Need to get the debugger to the desired location in source code? Here are a few tips that can make this faster.
-
Set Next Statement allows you to control what code will execute next, including re-executing code that has already run. This can be helpful for testing conditional branches of code without the need to modify the input to correctly satisfy the conditions for the desired code path.
-
Step Into Specific allows you to choose which function you step into when multiple functions are called on the same line of code.
-
Run to Cursor creates a one-time breakpoint so you don’t have to remember to unset it when you’re done. Run to Cursor works both to start debugging and run to a single location when you’re already debugging. It is available from the context menu in the editor or using the keyboard shortcut (Ctrl+F10).
- Run to Cursor also works in the Call Stack window. It finishes executing all of the child frames on the call stack and then pauses the program’s execution (just as if you had done as many Step Outs as required to stop on the selected call stack frame).

-
How to configure breakpoint conditions and actions (including the new UI experience in Visual Studio 2015), which covers
Data Inspection
Once you get the debugger to the desired location you’re probably going to inspect your application’s data. Here is a look at a few options:
- Debugger visualizers, specifically the built in visualizers for text, XML, HTML, JSON, DataSets, and WPF
- Return values show you values returned by all functions called on a line that is stepped over
- How to use DebuggerDisplay attributes to modify how the debugger displays variable values
- The ability to “pin” DataTips to the editor

Productivity Improvements
In the demos I also showed the improvements in Visual Studio 2015 that were some of your top requests to help improve productivity using the debugger:
- Much broader Edit and Continue support including Lambda expressions
- The new Exception Settings window in Visual Studio 2015
- Lambda expression support in the debugger windows
- PerfTips
- The Diagnostic Tools window
Learn more
The above content was a quick sample of what was covered in the talks. If this piques your interest I would recommend watching one of the talks listed above (here are the links again for convenience–Visual Studio Toolbox, Build, Ignite—most detailed). Additionally, you can follow the diagnostics team including the debugger on our team blog.
If you have any questions or comments, please let me know through Visual Studio’s Send a Smile feature, in our MSDN forum, via Twitter, or leave a comment below.
| Andrew Hall, Program Manager, Visual Studio Diagnostics @AndrewBrianHall Andrew has been at Microsoft for 7 years, all spent working on diagnostic tools. In his time on the team he has worked on the debugger, profiler, and code analysis tools. |



Lambda support in debug = AWESOME
Real trick would be if you would enable natvis with mixed mode.
Since you do not seem to bother improving/developing MFC or other C++ UI tools anymore, it easily leads to the situation where UI will be made with C# and fancy natvis is quite useless.
Unless I have missed some progress with the natvis.
Thanks for the great article! I didn't know that you could set multiple startup projects. Very helpful.
@Bob & گیت فروشگاهی
Are you debugging managed C++, or C# and native C++ only? As of Visual Studio 2013 natvis works when interop debugging except in the case of managed C++. If it is not working for you and you are not debugging managed C++, check to make sure that you do not have managed compatibility mode enabled (required for managed C++). See the following for more details on managed compatibility mode blogs.msdn.com/…/switching-to-managed-compatibility-mode-in-visual-studio-2013.aspx
you get the debugger to the desired location you’re probably going to inspect your application’s data. Here is a look at
بانک اطلاعات ساختمان
http://www.ojetafavot.net/bank-building-2
Feature suggestion for VS2015: filters for output window, like the ones DbgView has (show only this, hide this). Call it bad design, but many products log tons thru OutputDebugString/Debug[Trace].WriteLine, and most of it is not relevant to the task in hand, though the relevant part may change on the fly. Being able to switch filters on the fly will be highly beneficial.
Just my 2c.
@Alex, thank you very much for the suggestion. Would you please vote for this feature on Visual Studio's UserVoice site? visualstudio.uservoice.com/…/3534152-allow-interactive-filtering-of-debug-output-text
good
Diagnostic tools window not working in vs2015 RC.
Is there a Solution?
Diagnostic tools window not working in vs2015 RC.
Is there a Solution?
@Kurt: the Diagnostic Tools window may not support your current project and/or debug engine, check the blog post on the window for the supported configurations:
blogs.msdn.com/…/diagnostic-tools-debugger-window-in-visual-studio-2015.aspx
The common case is that you have managed or native compatibility mode set or are doing mixed mode debugging of a native project.
If your confiuration is supported, you might be hitting the following known issue: blogs.msdn.com/…/known-issue-for-diagnostics-tool-window-in-visual-studio-2015-rc-the-diagnostic-tools-failed-unexpectedly.aspx
well down!
Man oh man. You VS devs rock!! Thank you so much!
What is up with the fetish of making a simple task a giant pain in the ass. in VS2013 and before I could easily change between when exceptions were thrown and when they were unhandled. Now I have to triple click and reset to default to set and reset the feature.
@Matthew Whited – I think you are referring to how the Exception Settings "Break When Thrown" checkbox is now tri-state (meaning that the checkbox shows you when there are any exceptions checked underneath the category level), and so you need to click it multiple times to check-all and get a checkmark for the category.
If this is the case, we have made a small change for the next release so that it will go from the tri-state to the checked-state and then to unchecked-state and cycle through those as you click the box. Hopefully that will work better for you in the future.
Hi Andrew, I have a problem with my VS 2015 community. The debugger refuses to start when running an ASP.NET 5 web application. I un-installed it and re-installed and it worked, then when I closed VS and reopened to work on a new project it started all over again. I have searched for a solution online but non even talks about this issue. Microsoft work around solutions doesn't even mention it. I need some help. Thanks
very good it a betters soluation
@udoyen1 what error message do you see when your ASP.NET 5 application won't start?
Hello
First of all, I'd like to tell you that this blog is really interresting to explore 🙂
Many thanks for the time you take to share so much information with the readers.
I'd like to submit something that is puzzling me …
I'm using …
Windows 8.1 Pro with update 1
Microsoft Visual Studio Community 2015 RC Version 14.0.22823.1 D14REL
Microsoft .NET Framework Version 4.6.00057
Installed Version: Community
Visual Basic 2015 RC 00269-30000-00001-AA235
<quote from above article>
Use “Step Over” (F10) or “Step Into” (F11) when in design mode and it will take you to the entry point of the application
(assuming Just My Code is enabled) eliminating the need to find the line of code in the correct source file to place the breakpoint on.
</quote from above article>
If I open a project and click on Menu:Debug; Step over F10 or Menu:Debug; Step into F11
The program starts immediately and the GUI is displayed.
The execution does not stop at the entry point of the application.
(I checked that "Just my code" (Tools; Options; Debugging; General) is enabled)
Just to be sure, I created a new simple project with one form, a button on the form and some trivial instructions in the code (the Load routine of the form and the Click routine of the button.)
I remember that pressing F8 (step over) when debugging a VB code in previous versions of Visual Studio effectively jumped to the fist line of code in the Form's Load routine.
So … am I missing something ?
If I open a project with VS 2015 and look at some vb code file, I suppose that I am in the design mode.
Or should I do something explicitely to enter the design mode ?
Does someone have an idea ?
@Pat O' Logic, what type of application are you creating? There are a few types of apps that the step into functionality does not work for because they don't have "real entry points" in managed code, the entry points are actually implemented in an underlying native framework which the managed only debugger does not understand
@Andrew B Hall
Hi Andrew
Thanks for your reply 🙂
For a testing purpose, I just created a new project like this :
Launch VS 2015 Community RC
new project
templates
visual basic
windows
windows desktop
windows forms application
And created the following code:
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Button1.Size = New Size(200, 200)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Button1.Text = "hello"
End Sub
End Class
If I click on Debug; Step Over, the application is launched without stopping in the Form Load routine.
I posted my message because I supposed that maybe I could do some evident mistake with the 2015 RC environment, but I realize that maybe this blog is not the right place for a long Q/R conversation about my problems.
If you or someone in your team are willing to provide some help and/or getting more information, I'd be happy to use any other channel that you could give me to communicate.
Sorry for the delay… I'm living in Belgium and our time zone is UTC/GMT +2 (summer time).
@Pat 'O Logic: You can reach the debugger team at vsdbgfb@microsoft.com. Although in this particular case my apologies for not being clear in the post above, you are not doing anything wrong, Windows Forms fall into the category of projects that I mentioned in my previous comment where the debugger does not see the entry point due to underlying implementation of Windows Forms so step into will not stop in your code when you start debugging.
@Andrew B Hall
Hi Andrew
Thank you for these informations.
No need to apologise.
I have a long time experience with visual studio but mainly used Windows Forms and "first level" of debugging.
This is an oportunity for me to dive deeper in the waves of Visual Studio project categories and to learn more about the debugger. I surely will use the information you provide on this blog and follow the links.
Have a nice week-end.
Great post, thanks. As a predecessor to going to debugger, we use Stackify's APM (http://stackify.com) solution which gives us better indication of where in the code we need to focus
Nice improvements
Hi,
I have one doubt when i debug I am always using (Function key + pressing F11) can I debug it simply prssing F11 not touching function key. Is there any option for that??