Diagnostic Tips and Tricks for Windows Store Applications using Visual Studio 2012
-
Upload
microsoft-developer-network-msdn-belgium-and-luxembourg -
Category
Documents
-
view
784 -
download
0
description
Transcript of Diagnostic Tips and Tricks for Windows Store Applications using Visual Studio 2012
Diagnostic Tips and Tricks for Windows Store Applications using Visual Studio 2012Brad [email protected]
Agenda
• Mixed-language debugging• Contract debugging• Debugging background tasks• Debugging installed applications without a Visual
Studio project• JavaScript Memory Analyzer• Using First Chance Exceptions in C++
MICROSOFT CONFIDENTIAL – INTERNAL ONLY
Native/Managed Debugging for Store Apps• Remote Debugging Support• Native Visualization• Reliable Stepping
• Shipped in Update 1
I have options for “Native Only” and “Script Only” debugging.
What if I want to do both?
Debugging Native and JavaScript• No Mixed Mode Debugging Support• Use Multiple Instances Instead
Launch the app under the script debugger Attach with the native debugger from a second instance of VS
• Visual Studio naturally gives focus to the correct instance• Cannot Debug JavaScript when stopped in the native
debugger
Contract Debugging
• Windows 8 contracts provide a new entry point for applications
• It’s not the same code as just launching under the debugger
• Simply attaching is not quick enough as you may have missed the code that you wanted to debug
Contract Debugging
• Configure the app to debug without launch in the project properties
• F5 the app• Invoke your application manually through the contract
Background Tasks
• Your app can register to run background tasks when certain events happen
• Some background tasks are straight forward to test and debug because you can trigger them manually
• Others can be a much bigger pain Like a maintenance trigger that fires after 8 hours
Background Tasks
• Trigger background tasks from the Debug Location Toolbar• Can trigger tasks on apps that are not running
Set them to debug without launching first
• Can trigger tasks that do not require a payload
No Projects
• There are several reasons why you may not have a VS project, but still want to debug
Permissions Convenience Normally build/deploy outside of VS
• Attach to process is a pain for WWAs Especially if you need to debug startup code!
No Projects
• Use the “Debug Installed App Package Feature”• Works both local and remote• Can automatically stop at the first line of JavaScript Code
JavaScript Memory Profiler
• Identify unintentionally retained memoryand inefficient use of memory
• Snapshot-based tool• Shows JavaScript and DOM elements
Size Counts Reference graph
Memory terminology
Size: How large the object is in memoryRetained Size: The amount of memory that the object is preventing the garbage collector from reclaiming
Includes the size of the object Includes the size of all referenced objects (and any objects they reference) that the
current object is the only parent of in the memory graph
Size and retained size
Size Retained Size
Object A
Object B
Object C
Object D
500 KB 500 KB
100 KB 600 KB
Object A (100 KB)
Object B (500 KB)
Object C (50 KB)
Object D (100 KB)
50 KB
100 KB
50 KB
100 KB
Object A (100 KB)
Object B (500 KB)
600 KB
First Chance Exceptions
• Tough to find your real error in XAML apps• Turning on first chance exceptions can create a lot of noise
that can slow you down• Async patterns can make this worse
First Chance Exceptions
• Stop on Originate Error Exceptions for C++• Use the memory window on the third parameter to decode
the secret message
Related Sessions
Beat the Clock: Background Tasking in Windows 8Speaker: Jeff Prosise7 March 9:00
Diagnosing issues in your ASP.NET applications in production with Visual Studio 2012Speaker: Brad Sullivan7 March 10:45
More Info About Diagnostics
ALM Team Blog: http://blogs.msdn.com/b/visualstudioalm/
Request Features
Uservoice site: http://visualstudio.uservoice.com/