Diagnostic Tips and Tricks for Windows Store Applications using Visual Studio 2012


Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Diagnostic Tips and Tricks for Windows Store Applications using Visual Studio 2012

  1. 1. Diagnostic Tips and Tricks forWindows Store Applications usingVisual Studio 2012Brad Sullivanbrads@microsoft.com
  2. 2. 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++
  3. 3. Native/Managed Debugging forStore Apps• Remote Debugging Support• Native Visualization• Reliable Stepping• Shipped in Update 1
  4. 4. I have optionsfor “NativeOnly” and“Script Only”debugging.What if I wantto do both?
  5. 5. 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
  6. 6. 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
  7. 7. Contract Debugging• Configure the app to debug without launch in the project properties• F5 the app• Invoke your application manually through the contract
  8. 8. 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
  9. 9. 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
  10. 10. 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!
  11. 11. No Projects• Use the “Debug Installed App Package Feature”• Works both local and remote• Can automatically stop at the first line of JavaScript Code
  12. 12. JavaScript Memory Profiler• Identify unintentionally retained memory and inefficient use of memory• Snapshot-based tool• Shows JavaScript and DOM elements  Size  Counts  Reference graph
  13. 13. Memory terminologySize: How large the object is in memoryRetained Size: The amount of memory that the object is preventing thegarbage 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
  14. 14. Size and retained size Object A (100 KB) Object C (50 KB) Object B (500 KB) Object D (100 KB) Object A 100 KB 600 KB Object B 500 KB 500 KB Object C 50 KB 50 KB Object D 100 KB 100 KB
  15. 15. 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
  16. 16. First Chance Exceptions• Stop on Originate Error Exceptions for C++• Use the memory window on the third parameter to decode the secret message
  17. 17. Related SessionsBeat the Clock: Background Tasking in Windows 8Speaker: Jeff Prosise7 March 9:00Diagnosing issues in your ASP.NET applications in production with VisualStudio 2012Speaker: Brad Sullivan7 March 10:45
  18. 18. More Info About DiagnosticsALM Team Blog: http://blogs.msdn.com/b/visualstudioalm/
  19. 19. Request FeaturesUservoice site: http://visualstudio.uservoice.com/