200 likes | 400 Views
When Errors Happen: Debugging Microsoft Silverlight. John Papa www.johnpapa.net. Agenda 20 Minutes of Essential Tools. Tools for the job Which tool for which job HTTP Sniffing Debugging script errors Cross domain detection and debugging Testing posts and gets. Tools.
E N D
When Errors Happen: Debugging Microsoft Silverlight John Papa www.johnpapa.net
Agenda20 Minutes of Essential Tools • Tools for the job • Which tool for which job • HTTP Sniffing • Debugging script errors • Cross domain detection and debugging • Testing posts and gets
Tools • The right tools for the job is critical
Debugging Arsenal • Tools the fit the bill for Silverlight Fiddler 2 IE 8’s Developer Tools Silverlight Spy Web Development Helper FireBug
Watching Over You3 Free Tools • Fiddler 2 • Watches all HTTP traffic on a PC • Issue posts & gets, modify headers, messages • Silverlight Spy • Monitor HTTP traffic for a Silverlight application only • FireBug • Plug in for FireFox • WebDevelopmentHelper • Add-in for Internet Explorer • Works in both version 7 and 8
HTTP SniffingThe Watchdog • Fiddler, WebDevelopmentHelper, FireBug • Sniff out HTTP traffic • Watch requests, responses, and status
demo HTTP Sniffing
Script ErrorsIE 8’s Development Tools • Debug script • Locals • Watches • Breakpoints
Cross Domain Issues • Silverlight client calls a remote server’s service • Service is on different domain than the Silverlight client’s hosted server • Rejection by default • Must allow service to be called • REST, WCF, SOAP • Format: • http://msdn.microsoft.com/en-us/library/cc645032(VS.95).aspx
Cross Domain Policies • Silverlight looks for both • ClientAccessPolicy.xml (Silverlight) • CrossDomain.xml (Flash format) • File must be in the web root • NOT APP ROOT! • Use HTTP sniffer to detect problems
Restrictive Policy <?xml version="1.0" encoding="utf-8"?> <access-policy> <cross-domain-access> <policy> <allow-from http-request-headers=“SOAPAction, Content-Type"> <domain uri="http://johnpapa.net"/> </allow-from> <grant-to> <resource path="/MyAwesomeServices/" include-subpaths="true"/> </grant-to> </policy> </cross-domain-access> </access-policy>
Cross Domain PoliciesWatching • Silverlight can access web services on different domains • Looks for cross domain policy files • Detect the policy files and analyze them • Options: • HTTP Sniffing detects a problem • Browse directly to see them • Silverlight Spy to analyze them
demo Cross Domain Checks
Tools ReferenceKey Features • Fiddler 2 • HTTP monitoring • Issue posts & gets, modify headers, messages • fiddler2.com • Silverlight Spy • HTTP monitoring • Explore Isolated Storage contents • silverlightspy.com
Tools ReferenceKey Features • WebDevelopmentHelper • HTTP monitoring for Internet Explorer • projects.nikhilk.net/WebDevHelper • FireBug • HTTP monitoring for FireFox • getfirebug.com • Internet Explorer 8 Developer Tools • Debugging scripts and page analysis • Built into IE 8
Thanks!Find More Information … • silverlight.net • johnpapa.net
Please Complete an Evaluation FormYour feedback is important! • Evaluation forms can be found on each chair • Temp Staff at the back of the room have additional evaluation form copies
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.