Diagnostic Tools debugger window in Visual Studio 2015
January 16, 2015
Note: this post has been updated for Visual Studio 2015 RTM
This blog post introduces the new Diagnostic Tools window in Visual Studio 2015. First we’ll define what we mean by diagnostic tools, then we’ll introduce the Diagnostic Tools window, and then we’ll dive into the different tools in the window.
What are Diagnostic Tools?
First let’s define what we mean when we say “Diagnostic Tools” in Visual Studio. Diagnostic tools means different things to different people, and some would consider the debugger itself to be a diagnostic tool. In this context, when we say Diagnostic Tools, we mean tools that allow you to see historical information (data collected over time), as opposed to just a single moment in time (like when you are stopped at a live breakpoint). By that definition, there are three main examples of diagnostic tools that were available previously in Visual Studio 2013:
- The Output window: allows you to see program output and other debugger events while it is running
- IntelliTrace: allows you to see interesting events in your application and set the debugger back in time so that you can look at historical data in the Call Stack, and Locals windows. You can also see the list of every method call and its parameters (even when that method is no longer on any call stack).
- The Performance and Diagnostics hub: allows you to perform a comprehensive performance analysis of your app as it runs without the debugger. You have your choice of performance tools to use, such as the CPU Usage tool and the Memory Usage tool, depending on the nature of the performance issue.
As you will see, we have taken all of these diagnostic tools and brought them closer together into a unified window. This new experience offers you two benefits:
- The ability to monitor performance while debugging, and correlate performance data with debugging activity, and
- A much richer and more useful experience for IntelliTrace and the Output window, dramatically shortening the time it takes you to diagnose an issue or verify a fix.
Diagnostic Tools window
Our vision for Diagnostics Tools during debugging is just beginning, and for our first release in Visual Studio 2015 CTP 5, the main change that you will notice when debugging is the new Diagnostic Tools window. If your project type and debugging configuration is supported (as described at the end of the post), you will now see a “Diagnostic Tools” window appear when you start debugging (press F5):
The diagnostic tools in this window surface information in two complementary ways: by adding graphs to the timeline in the upper half of the window, and by providing detailed information in the tabs in the bottom half of the window. Diagnostic tools use graphs to surface at-a-glance information, and when you see something of interest you can select a range of time (as described in the next section) to filter the detailed information in the tabs below.
With the current release, you will see 3 tools in the Diagnostics Tools window: Events, Memory Usage tool, and CPU Usage tool. You can enable or disable the CPU and Memory tools by clicking on the select tools dropdown:
It is worth noting that the Events tool two different tracks showing events that occur while debugging: Break events, and IntelliTrace events. Next we’ll examine each one of those tracks under the Debugger, and then we’ll talk about the CPU Usage and Memory Usage tools.
Break events track and automatic time range selection
The Debugger break event track at the top of the timeline provides a visual history of events that stopped or resumed the execution of the application. This includes breakpoints being hit, stepping through code, clicking the Break All (pause) button, breaking exceptions, and Debugger.Break() statements in code. The rectangles indicate the amount of time the app was running in between break events, and colored line that you see when hovering over the rectangles indicates whether the app was paused due to a breakpoint being hit (indicated by red), for a step running to completion (indicated by yellow), or for Break All (indicated by blue).
You will notice that the range of time selected and the current zoom level in the timeline will update automatically as you set breakpoints and step, to reflect your latest debugging actions. The detail tabs at the bottom of the window are filtered to the selected range of time so that you automatically see data for your most recent debug actions.
When you press F5 or click Continue, the next time you hit a breakpoint in the debugger the time selection will start at the time you pressed F5, and end at the current breakpoint:
Notice that the red rectangle indicates the duration that the program ran since the last breakpoint (or since starting the program if this is the first breakpoint hit).
When you step in the debugger (e.g. with F10, F11, or Ctrl+F10), the start time of the selection will stay the same, but the end of the selection will expand to include the last step:
If you want something other than the automatic time selection, you can change the selection at any time by clicking on one of the debug break actions to snap the selected range of time to that event:
…or by clicking and dragging on the graphs or the ruler to select a more specific range of time:
The new and improved IntelliTrace experience
In Enterprise SKUs IntelliTrace enhances the debugging experience and saves you valuable debugging time! It does that by capturing additional events with useful information about your program’s execution, allowing you to identify potential root causes with fewer debugging iterations. The data it collects appear as events the IntelliTrace track and in the table in the Events details tab.
For all events (except for Output events), IntelliTrace also captures information that allows you to set the debug windows back in time and see the call stack, and local variables at the time that the event occurred. Simply select an event in the table and click “Activate Historical Debugging” to take advantage of this feature.
You can also change IntelliTrace’s collection options (In Tools -> Options -> IntelliTrace) to capture call information and see a full history of every method call and the parameters passed. For a deep dive on the IntelliTrace experience please see the dedicated IntelliTrace blog post.
IntelliTrace shows debug messages from the Output window
Messages that are sent to the Debug tab of the Output window are captured by IntelliTrace so that you can see where debug output occurred over time in the Output track:
This allows you to visually scan and quickly identify the information that interests you. You can hover the mouse over each individual event to quickly see the output message, and select the range of time to see the detailed list of output events in the debugger details tab.
In the table you will see the time stamps for each output event. Not only does this provide useful timing information that is not available in the Output window, it also saves you from having to change your code to log this information manually when you need it. If you find that you prefer to use the Output window, it is still there and you can continue to use it – but please let us know what we can do to make the Debugger Events tool work better for you.
Memory Usage tool while debugging
You will notice that we have brought the Memory Usage tool into the debugging experience, allowing you to monitor memory usage and investigate memory issues while you are debugging.
You can simply glance at the graphs to see the Memory impact of your app, and the break events allow you to identify the parts of the graph that are related to recent debugging activity. You can take snapshots before and after various debug actions and then drill-into those snapshots to analyze memory usage and memory growth. For more on memory please see the dedicated Memory Usage blog post.
Monitoring and measuring performance
Debugger PerfTips (announced in CTP3) provide performance information right in your code as you set breakpoints and step with the debugger.
You might find yourself searching for pen and paper to write down the values shown in the PerfTips. Now you can click on the PerfTips to bring the Diagnostic Tools window into focus so that you can see all previous PerfTip values. The elapsed time for previous PerfTips can be found by hovering over the events in the Debugger break event track, and in the duration column for break events in the Debugger Events details tab.
Note that in the screenshot above we filtered out all IntelliTrace events showing, which allows you to focus in on just the PerfTip history using the break events in the table.
The CPU Usage graph allows you to see how much CPU resources are used by your code. You can use the break events track to correlate spikes in CPU with code that was running between breakpoints.
If you spot a potential issue when debugging, you can get a per-function breakdown of CPU Usage by running the CPU Usage tool without the debugger. To do this go to Debug -> Start Diagnostic Tools without Debugging, select CPU Usage, and click Start.
Supported project types and configurations
The following startup project types and debugging configurations are supported by the Diagnostic Tools window in Visual Studio 2015:
- Managed WPF, WinForms, Console projects
- Native Win32, Console, and MFC projects
- ASP.NET projects running on a local IIS and IIS Express
- Managed or Native Windows Store projects
- Debugging sessions started using Debug –> Attach to Process
- Debugging apps running on remote desktop devices
The Diagnostic Tools window currently does not support:
- Windows Store projects that are using JavaScript
- Windows Store projects that are running on a Windows Phone
- Debugging when Managed or Native Compatibility Mode is checked in Tools –> Options –> Debugging
Give it a try and tell us what you think!
We are excited about the new experience for our diagnostic tools in Visual Studio and the new capabilities it provides to developers. You can try out these new features now by downloading Visual Studio 2015 RC, and if you do, please give us your feedback so that we can improve. You can leave general comments & questions at the end of this blog post or via Send-a-Smile, and submit feature requests to our Diagnostics UserVoice.
For an in-depth look at how to use these features, be sure check out the following blog posts:
- IntelliTrace in Visual Studio Enterprise 2015
- Walkthrough of Live Debugging using IntelliTrace in Visual Studio 2015 (Text Editor)
- Walkthrough of Live Debugging using IntelliTrace in Visual Studio 2015 (Social Club)
- Memory Usage tool while debugging in Visual Studio 2015
- Diagnosing Event Handler Leaks with the Memory Usage Tool in Visual Studio 2015
- PerfTips: Performance information at-a-glance while debugging with Visual Studio
… and videos:
Will mobile diagnostics tools be separate for now?
msdn.microsoft.com/…/jj215908%28v=vs.105%29.aspx
@Dev: In short, yes. The tools you linked to are the profiling tools (that run without the debugger) for Windows Phone Silverlight application. All of our profiling tools, including the ones you linked to for Windows Phone Silverlight, will continue to be offered independent of the Diagnostic Tools debugger window so that you can do fine tuned performance analysis without the debugger overhead.
The Diagnostic Tools debugger window, when you F5, offers you the ability to keep an eye on performance while you are debugging during normal feature development, and finer control of the application so that you can filter performance information using breakpoints and stepping. It is not yet available for Phone, though.
Awesome news! When will ASP.NET 5 & IIS Support become available?
Great! But what I really miss is colored output in the output window. For instance, if my application outputs "[Error] Something bad happens", I want to be able to configure Visual Studio to print that line in red, for instance. There is an extension for that (VSColorOutput), but unfortunately, it's not working reliably (sometimes changes the background of colors so that they are hardly readable in the dark theme). Still, I can't live without that extension anymore! It would be great if the VS bugs negatively impacting VSColorOutput where fixed, or, preferably, if VS just supported this out of the box.
Upgraded from VS 2015 Preview to give the Diagnostics Tools a try but can't get them to work. I seem to get different errors. Yesterday when I tried, the tool window opened with a spinning progress indicator but it never finished loading. Sometimes it did stop after a while and showed that an unspecified error occurred and that the Diagnostics Hub in the Output window may have more info (it contained only one uninteresting line though). Today I gave it another few tries but now the tool window does not even load anymore and says "does not support the current startup project or debugging configuration". Tried with C# WinForms and native console apps, Debug/Release and x86/x64 configurations to no avail.
Interesting. Just restarted VS and gave it one last try and it works for both managed and native projects. Go figure.
Hi Dan,
Where you say that native Win32 is supported, does this mean 32-bit x86 and 64-bit x64, or just 32-bit? If it's currently only 32-bit, is the intention to have 64-bit supported by RTM?
In general I like the idea and the improvements you made, so thanks for them! However, the second screenshot looks awful — a popup window with buttons (Apply and Cancel)? Could you please fix this?
Thanks!
CPU Usage doesn't appear to want to work for me with a 32-bit Win32 project (running VS 2015 CTP5 in a Hyper-V VM).
When I start debugging, the Diagnostic Tools window reports: "To see CPU usage details, run the CPU Usage tool without the debugger (Debug -> Start Diagnostic Tools Without Debugging)"
But when I do that and check CPU Usage option, I initially get a prompt to run VsStandardCollector.exe (which I allow) and then I get:
"Diagnostics session failed to start.
Failed to enable system trace session."
@Artel: ASP.NET 5 and IIS support are important to us but I can't comment on time frame at this time. Keep an eye out for this in future releases!
@Axel: neat suggestion, if you would like to see it as part of the Diagnostic Tools please open a UserVoice item (using the link at the end of the blog post) so that others can vote on it. You could also try to contact the owners of VSColorOutput to see if they can fix the bugs for you.
@Niro: thanks for reporting the issue and glad that you were able to get it working. We will see if we can reproduce this problem on our end and fix it in future releases.
@David: 64-bit is supported for native Win32 projects, as well as managed desktop projects. It is only Windows Store apps that are missing 64-bit support at the moment.
@Ooh: thanks for the feedback. Is it the apply/cancel that you find ugly, the overall appearance of the window, or something else? In case you thought this was a modal dialog box, it is not, it is a dropdown menu.
@David: the system trace session can fail to open if there are 8 or more ETW sessions using the system trace provider on your system. This is unlikely to be the case on your VM, however, so it is likely a bug in our code. Can you file a bug on connect.microsoft.com so that we can exchange more information and get some additional logs from your system?
@Dan: I partially agree with Ooh. I do think that presenting the options in a context menu is okay but the way it is currently designed and behaves is inconsistent. Those checkboxes shouldn't have special cursors (hand), they are checkboxes, not links. Also, please use the default style for those buttons or even remove the buttons and make the popup a plain simple context menu with checkable items.
Could you clarify which features are reserved for the Ultimate SKU, and which (if any) would be in the eventual Community SKU?
@Niro: thanks for the feedback, we will take a second look at the design.
@Nick: good question. SKU plans will be disclosed soon, stay tuned!
@Axel – Can you, please, vote and add any comments on visualstudio.uservoice.com/…/6791695-highlight-color-of-text-in-output-window
Thanks!
"The Diagnostics Tools window does not support the current startup project and/or debugging configuration".
um, ok. I have a x64 Native .exe application being debugged in mixed configuration. What's the problem?
..same error with Native Only debugging. A bit of explanation instead of "not supported" sure would go a long way. What's not supported about it?
@jschroedl: thanks for reporting these issues! I am also seeing the window not appear for Native projects when the debug engine is set to mixed, we'll look into that. However the window comes up for me when the debug engine is set to "Native Only" for x64 .exe projects.
Can you try closing and re-opening VS and seeing if that fixes it for Native Only? If not, please contact me directly at dantaylo [at] microsoft.com so that we can exchange more information to help us reproduce the issue.
thanks for all these previews and CTPs. This is great!
before i get to the point of actually testing this feature however i would like to be able to disable it just to see that the debugging performance can is as usual when currently not in need of the still not studied feature set.
So what is the easy way to get to normal debugging speed? (i tried deselecting the two checkboxes Memory Usage and CPU Usage, however it didn't really affect the preformance in my case)
@Dummy: you ARE seeing the normal debugging speed, even when you have the window on! We have gone to great lengths to ensure that debugging performance in VS 2015 with the Diagnostic Tools window on is the same as it was in VS 2013 without the Diagnostic Tools window. That being said, if you turn the window off you may see a small speedup. We have made a few debugging performance improvements so that we could add the window and keep debugging just as fast as it was in the previous release.
If you want to disable the feature altogether you can currently do so from Tools -> Options -> Debugger -> Diagnostic Tools and changing "Enable while debugging" to False. You should not notice much (if any) difference in performance, though.
Thanks for the reply Dan.
I restarted VS and switched to "Native Only" and the window did appear when I started debugging. I almost always debug in Mixed Mode so it will be really useful to me when this works there too!
—
I have to agree with others that the Apply | Cancel is a bit strange in a dropdown since all the options will only apply at the next launch anyway. Perhaps if there were to be more options which apply immediately it would make some sense.
Should we see "Debugger Events" for Native debugging? I see perf tips as I F10 step but no "Debugger Events" area so no log of previous times anywhere.
i needed to disable Intellitrace to get the old speed.
@jschroedl: as noted in the blog post, the Debugger Events tool is not currently available for Native projects. We'll get to it when we can. Thanks for all the feedback!
@greg Thank you for letting us know that you encountered a performance issue when using IntelliTrace. We truly appreciate it when our customers report issues rather than hope somebody else does it instead. 🙂 With the default settings we do not expect you to be able to notice IntelliTrace's overhead while debugging, so I'm very curious as to why you are seeing a noticeable performance hit. Please get in touch with me directly at angelpe@microsoft.com so we can get to the bottom of this (I have no contact info for you).
Do these debugger things (cpu memory diag.) work on non-iCore CPUs? I can't get much of anything going in the vs 2013 Comm. version. For a WP device on vs2010 Pro I think it was it worked for C#, but nothing gets going on an Intel Q8200 CPU for native code. Was it supposed to work in vs2013 Comm. version? 2015 CTP?
I tried using Debug tool for Windows Phone 8 Silverlight application but it always shows me following error message: "Start debugging a supported project type to see diagnostics data". Is Diagnostics tool not supported for WP8 Silverlight?
@Core: the CPU and Memory diagnostic features should work just fine on non-iCore CPUs. They use Windows/CLR APIs that are available across architecture types. The reason you are not seeing them is that you are using Visual Studio 2013, and these new features are only available in Visual Studio 2015. In Visual Studio 2013 you can use the profiling tools in Debug -> Performance and Diagnostics (Alt+F2) to do similar analysis, but without being able to control app execution using the debugger.
@Balraj: the window is currently not available for Windows Phone at all. Any Windows Phone debugging (both device and emulator) falls into the classification of "remote devices", which is listed as not supported in the blog post.
It's sad at how much of the VS enhancements now-a-days are geared towards Ultimate. It feels like Premium MSDN subscribers get left in the dust.
Is it be possible to split out the CPU usage per core? I'd find that view really useful.
I always get "The Diagnostics Tools window does not support the current startup project and/or debugging configuration" When i try to debug a console application or WPF application
can you some one help me to get Diagnostic tools window to show?
@jose: you may get this message if you have "Use Managed Compatibility Mode" checked in Tools -> Options -> Debugging. Otherwise we have seen some bugs where Visual Studio needs to be restarted for the Diagnostic Tools window to work. If you have further problems, feel free to contact me at dantaylo [ at ] microsoft.com and we will see if we can resolve the issue.
@Kelley: it is not possible, we are considering adding more information about CPU cores in the future. Is it sufficient to see the # of cores on the CPU Usage graph axis or would you want a separate graph for each core?
Thanks Dan. This option worked for me..
Hi,
this tool looks amazing!! howerver i had a couple of questions :
is this tool compatible with MFC applications??
could we run this tool without visual studio as a part of daily test runs?
@kaki2000: this window does support MFC applications. At this time we don't have any support for automating this as part of build/test runs, but thanks for the suggestion!
I amn writing native C++ code and I don't see intellitrace anywhere. Not in Diagnostic tools or any where else. I am using VS enterprise 2015 RC.
@I see little love for native code: we love native code! The PerfTips, Debugger Break Track, CPU and Memory diagnostics features all support native. You may not see the diagnostic tools for native if your debug engine is set to mixed-mode in project properties, or if you have native compatibility mode checked in Tools -> Options -> Debugging.
Otherwise go Debug -> Show Diagnostic Tools and if it says that the tools failed unexpectedly, you may be hitting the issue described here:
blogs.msdn.com/…/known-issue-for-diagnostics-tool-window-in-visual-studio-2015-rc-the-diagnostic-tools-failed-unexpectedly.aspx
If you can't get it working ping me at dantaylo [at] Microsoft.com and we'll figure out what the issue is.
I'm confused, I see in the blog post that I should be able to debug a ASP.NET MVC application using IIS Express yet the diagnostic tools window doesn't open then I F5 and if I open it via Debug –> Show Diagnostics tools I get 'The diagnostic Tools windows does not support debugging using the 'Script' debug engine.
What have I mis-understood or done wrong here ?
@John Kattenhorn
I have logged a bug with Microsoft Connect about this
connect.microsoft.com/…/diagnostic-tools-window-failed
@John: you might be hitting the following known issue if you have mismatched OS and VS languages:
blogs.msdn.com/…/diagnostic-tools-debugger-window-in-visual-studio-2015.aspx
Matt commented in the connect bug that this fixed his issue, let me know if you are still having issues after trying out the steps described there.
I am using VS2015 RTM to try to find a memory leak in a native 32-bit MFC application, built to target v140_xp i.e. Windows XP via 7.1 SDK.
However, the memory diagnostics does not work well at all. Switching to "Stack View" results in never-ending "Retrieving…" when looking at a diff between two snapshots. Under the "Types View" I do get types for most but some are undetermined. However, the biggest issue is one cannot see the callstack for a given instance when trying to dig deeper. Instead the call stack only shows something like ProcessName!0x23492382() that is the address and not the method names. This despite all modules having symbols loaded incl. ntdll and despite the main "Caller"/"Callee" dialog does show some call stack info. Go To Source does not work either. It just seems to work rather poorly.
On top of this, we are trying to debug a slow memory leak, but the tool does not seem to be useful for this since it uses a extreme amounts of memory and/or disk space if running for just a short time. Even when running with no debugger attached and only profiling memory usage.
Why does the above things not work? We upgraded because this was supposed to help us track down a difficult memory leak.
@HarryDev: Sorry to hear you are having issues with the memory profiler when running on native code, could you please send my an email so we can further investigate the issue: adwelch@microsoft.com
Thanks!
Adam
How the F do I turn off this unwanted feature?
@Mike: if you find the window annoying you can simply close it and it will not re-appear. If for some reason you want to disable the feature entirely, you can do so by unchecking "Enable diagnostic tools while debugging" from Tools -> Options -> Debugging
I noted you all have mentioned performance of the IDE related to tooling. While not exactly related to diagnostics I've noted a real degradation in the editor with brace matching.
VS2013 almost instantly highlights a matching brace but VS2015 is annoyingly slow. This is a feature I probably use 'by the minute' and slowing it down slows me down. This is an area that VS 2015 needs performance improvement returned.
I don't quite understand why the team decides to turn on somewhat rarely used features and are concerned about performance yet we slowdown features that are used by the minute.
What do we need to do to get development time IDE performance back?
Can the diagnostics tools be disabled? It seems to slow down my Win 10 VM.
@Dirk: I'm sorry to hear they are slowing down your VM, we are making a few performance improvements in the coming updates. It would help us to improve performance for your specific machine if you could send us a performance trace using Send-a-smile, instructions are here: msdn.microsoft.com/…/mt280277.aspx
You can disable them in Tools -> Options -> Debugging and uncheck "Enable diagnostic tools while debugging", but if you send us a trace we can hopefully provide an update that you feel happy leaving the tools enabled!
@Mike: we track and improve performance across Visual Studio, the issue you are hitting may be specific to your project, machine, or extensions you have installed. I recommend using Send-a-Smile and attaching a performance trace so that the team can investigate your specific issue:
msdn.microsoft.com/…/mt280277.aspx
Hi Dan
I get Diagonstics tools failed unexpectedly.
In Diagnostics Hub output window I have
is not a valid Win32 application (Exception from HRESULT: 0x800700C1)
It seems no longer possible to attach the profiler to a running Windows process, like can be done with the debugger. I had to revert to VS2013 to profile my running web application published to IIS.
@Sorin: we have received multiple reports of this failure and it would help us if you could report this issue through send-a-smile so that we can follow up with you if needed:
msdn.microsoft.com/…/mt280277.aspx
@Berend: the attach capability is still available through Debug -> Profiler -> Performance Explorer -> Attach/Detach… menu option, let me know if it is not working for you!
Loving the new Visual Studio. A pleasure to work with and dare I say even debug. 🙂 Thanks!
Hello,
I've discovered the way to break into native code and have access to STL containers' content when debugging using CLI :
ToolsOptions…DebuggingGeneral : uncheck 'Use Managed Compatibility Mode' (YES! UNCHECK IT!)
In the native code, instead to add breakpoints, just add this :
assert(false);
When breaking against the shores, just click either 'Retry' to debug or 'Ignore' to continue.
Happy debugging with Visual Studio 2015 🙂
Kochise
Great tool! Can you please tell me if it is possible to use Diagnostic Tools debugger window in a typescript Node.js Express application? It says "The Diagnostic Tools window does not support the current debugging configuration". In debug options I unchecked "Use Managed Compatibility Mode" but still nothing. Is there any workaround or similar tool that I could use? I'm currently using Visual Studio Community 2015 with Node.js Tools plugin installed.
Thanks for the help
The Diagnostic Tools window does not support any JavaScript based projects, whether they use IE or the Chrome V8 debug engine. If this is something you would like to see in the future please consider creating a UserVoice item here so that others can vote on it:
http://visualstudio.uservoice.com/forums/121579-visual-studio-2015/category/31799-debugging-and-diagnostics
@Axel, @Dan – VSColorOutput has been updated and fixes the color issues.
It also adds a new timestamp feature and sports easier color selection.
Cool — thanks for the tip! Would be great to know if there’s any features from the VsColorOutput extension that you would find useful in the Diagnostic Tools window.
My system win7 64-bit, before the installation of VS2010, but also installed vs2015 Enterprise, debugging time has been displayed “is starting diagnostic tool”!
The output has been loaded with “C: \ Windows \ SysWOW64 \ api-ms-win-core-file-l1-2-0.dll”. Can not find or open PDB file,But this .dll absolutely exists.