SlideShare a Scribd company logo
Diagnostic Tips and Tricks for
Windows Store Applications using
Visual Studio 2012
Brad Sullivan
brads@microsoft.com
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++
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 memory
  and 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 memory
Retained 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

 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
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 8
Speaker: Jeff Prosise
7 March 9:00

Diagnosing issues in your ASP.NET applications in production with Visual
Studio 2012
Speaker: Brad Sullivan
7 March 10:45
More Info About Diagnostics

ALM Team Blog: http://blogs.msdn.com/b/visualstudioalm/
Request Features

Uservoice site: http://visualstudio.uservoice.com/

More Related Content

PDF
DCAST Meetup - Washington, DC Feb 2016
PDF
Selenium Israel Meetup
PDF
Belfast Selenium Meetup
PPTX
Helpful Automation Techniques - Selenium Camp 2014
PDF
Webdriver.io
PDF
Selenium Camp 2016 - Kiev, Ukraine
PPTX
Performance testing with VSTs on- and off-premises
PPTX
Using REST with VSTS and TFS
DCAST Meetup - Washington, DC Feb 2016
Selenium Israel Meetup
Belfast Selenium Meetup
Helpful Automation Techniques - Selenium Camp 2014
Webdriver.io
Selenium Camp 2016 - Kiev, Ukraine
Performance testing with VSTs on- and off-premises
Using REST with VSTS and TFS

What's hot (20)

PPTX
Selenium and Appium Training from Sauce Labs
PPTX
Aspect oriented programming
PDF
Si fa presto a dire serverless
PPTX
Lessons Learned From Applications That Kicked Titanium's Ass
PDF
130511 stop wasting_your_time
PPTX
Sauce Labs for Visual Studio Team Services & TFS
PDF
An Introduction to ReactNative
PPTX
Write Better JavaScript
PPTX
Cypress workshop for JSFoo 2019
PPTX
Introduction to cypress in Angular (Chinese)
PPTX
Writing better tests for your java script app
PPTX
Single Page Applications: Your Browser is the OS!
ZIP
Titanium @ Minnebar
PDF
Automation Best Practices
PDF
Automated testing with Cypress
PPTX
Advanced AngularJS Tips and Tricks
PPTX
Introduction To Cloud Computing Winsows Azure101
PDF
Cypress testing
PDF
Sharing the pain using Protractor
PDF
DevQA: make your testers happier with Groovy, Spock and Geb (Greach 2014)
Selenium and Appium Training from Sauce Labs
Aspect oriented programming
Si fa presto a dire serverless
Lessons Learned From Applications That Kicked Titanium's Ass
130511 stop wasting_your_time
Sauce Labs for Visual Studio Team Services & TFS
An Introduction to ReactNative
Write Better JavaScript
Cypress workshop for JSFoo 2019
Introduction to cypress in Angular (Chinese)
Writing better tests for your java script app
Single Page Applications: Your Browser is the OS!
Titanium @ Minnebar
Automation Best Practices
Automated testing with Cypress
Advanced AngularJS Tips and Tricks
Introduction To Cloud Computing Winsows Azure101
Cypress testing
Sharing the pain using Protractor
DevQA: make your testers happier with Groovy, Spock and Geb (Greach 2014)
Ad

Similar to Diagnostic Tips and Tricks for Windows Store Applications using Visual Studio 2012 (20)

PDF
orcreatehappyusers
PDF
orcreatehappyusers
PPTX
No backend
PDF
Writing less code with Serverless on AWS at AWS User Group Nairobi
PPTX
Building Mobile Web Apps with jQM and Cordova on Azure
PDF
Writing less code with Serverless on AWS at FrOSCon 2021
KEY
Enterprise Strength Mobile JavaScript
PDF
Droidcon Spain 2105 - One app to rule them all: Methodologies, Tools & Tricks...
PPTX
Real World Windows 8 Apps in JavaScript
PDF
스타트업과 개발자를 위한 AWS 클라우드 태권 세미나
PPTX
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
PDF
Writing less code with Serverless on AWS at AWS Community Day DACH 2021
PDF
Should you use HTML5 to build your product? The pros & cons of using current ...
PPTX
Phonegap - An Introduction
PDF
SWTT 140407 session04
PPTX
Xamarin.Forms Bootcamp
PDF
Writing less code with Serverless on AWS at OOP 2022
PPTX
Office Add-in development
PPTX
Analyze Your Code With Visual Studio 2015 Diagnostic Tools
PDF
Next Step, Android Studio!
orcreatehappyusers
orcreatehappyusers
No backend
Writing less code with Serverless on AWS at AWS User Group Nairobi
Building Mobile Web Apps with jQM and Cordova on Azure
Writing less code with Serverless on AWS at FrOSCon 2021
Enterprise Strength Mobile JavaScript
Droidcon Spain 2105 - One app to rule them all: Methodologies, Tools & Tricks...
Real World Windows 8 Apps in JavaScript
스타트업과 개발자를 위한 AWS 클라우드 태권 세미나
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Writing less code with Serverless on AWS at AWS Community Day DACH 2021
Should you use HTML5 to build your product? The pros & cons of using current ...
Phonegap - An Introduction
SWTT 140407 session04
Xamarin.Forms Bootcamp
Writing less code with Serverless on AWS at OOP 2022
Office Add-in development
Analyze Your Code With Visual Studio 2015 Diagnostic Tools
Next Step, Android Studio!
Ad

More from Microsoft Developer Network (MSDN) - Belgium and Luxembourg (20)

PPTX
Code in the Cloud - Ghent - 20 February 2015
PPTX
Executive Summit for ISV & Application builders - January 2015
PDF
Executive Summit for ISV & Application builders - Internet of Things
PPTX
Executive Summit for ISV & Application builders - January 2015
PPTX
PPTX
cloud value for application development
PPTX
PPTX
Inside the Microsoft TechDays Belgium Apps
PPTX
PPTX
PPTX
Applied MVVM in Windows 8 apps: not your typical MVVM session!
PPTX
Building SPA’s (Single Page App) with Backbone.js
PPTX
Deep Dive and Best Practices for Windows Azure Storage Services
PPTX
Building data centric applications for web, desktop and mobile with Entity Fr...
Code in the Cloud - Ghent - 20 February 2015
Executive Summit for ISV & Application builders - January 2015
Executive Summit for ISV & Application builders - Internet of Things
Executive Summit for ISV & Application builders - January 2015
cloud value for application development
Inside the Microsoft TechDays Belgium Apps
Applied MVVM in Windows 8 apps: not your typical MVVM session!
Building SPA’s (Single Page App) with Backbone.js
Deep Dive and Best Practices for Windows Azure Storage Services
Building data centric applications for web, desktop and mobile with Entity Fr...

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

  • 1. Diagnostic Tips and Tricks for Windows Store Applications using Visual Studio 2012 Brad Sullivan brads@microsoft.com
  • 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. Native/Managed Debugging for Store Apps • Remote Debugging Support • Native Visualization • Reliable Stepping • Shipped in Update 1
  • 4. I have options for “Native Only” and “Script Only” debugging. What if I want to do both?
  • 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. 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. Contract Debugging • Configure the app to debug without launch in the project properties • F5 the app • Invoke your application manually through the contract
  • 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. 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. 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. 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. 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. Memory terminology Size: How large the object is in memory Retained 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
  • 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. 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. First Chance Exceptions • Stop on Originate Error Exceptions for C++ • Use the memory window on the third parameter to decode the secret message
  • 17. Related Sessions Beat the Clock: Background Tasking in Windows 8 Speaker: Jeff Prosise 7 March 9:00 Diagnosing issues in your ASP.NET applications in production with Visual Studio 2012 Speaker: Brad Sullivan 7 March 10:45
  • 18. More Info About Diagnostics ALM Team Blog: http://blogs.msdn.com/b/visualstudioalm/
  • 19. Request Features Uservoice site: http://visualstudio.uservoice.com/