Mastering IntelliTrace in Development and Production

2,790 views

Published on

A session at the Sela Developer Practice covering IntelliTrace, a powerful feature of Visual Studio Ultimate that can provide historical debugging information collected in development or production environments. IntelliTrace is a hybrid logger-profiler-debugger that can uncover super-difficult bugs by tracing through the history of the application's execution.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,790
On SlideShare
0
From Embeds
0
Number of Embeds
586
Actions
Shares
0
Downloads
13
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • Run the JackCompiler console app example and show how we step through, step back, and view the various events.
  • 1.Run JackCompiler.Tests (not in debug mode) and then show the failing test.In the test output, click the .iTrace file and then view the trace, get them to see the exception and then trace back through the call stack and the various calls to see that we had a “do” statement without a closing semicolon.2.Show the stand-alone collector (IntelliTraceSC.exe) to run SDPApp.WPF with IntelliTrace collection.:IntelliTraceSC.exe launch /cp:…trace.xml /f:foo.itrace SDPApp.WPF.exe(make sure that the collection plan collects information for item selection changes)3.Open the .iTrace file from the ready-made SDPApp.WPF run and explain that the user complained they got a message box saying “Invalid Operation Exception”.Find the MessageBox event in the Events View and then use the Calls View to show that it happened while still loading speaker data. (The user clicked Load and then immediately clicked a speaker in the list before the list was fully loaded.)
  • Go to sdpapp.cloudapp.net and view Sasha Goldshtein. An error page is displayed.Right-click the instance in Server Explorer and download the IntelliTrace logs.Find the culprit thread by looking at the request details, and then look at the Calls View until we can find the controller method that was invoked.For backup: C:\Users\Sasha\AppData\Local\Temp\Downloaded WAT Diagnostics Logs
  • Mastering IntelliTrace in Development and Production

    1. 1. SELA DEVELOPER PRACTICE December 15-19, 2013 Sasha Goldshtein CTO, SELA Group @goldshtn blog.sashag.net Mastering IntelliTrace in Development and Production © Copyright SELA software & Education Labs Ltd. | 14-18 Baruch Hirsch St Bnei Brak, 51202 Israel | www.selagroup.com
    2. 2. IntelliTrace® Profiler-logger-debugger hybrid “Historical Debugging” Tracks events and method call information at runtime Records stack trace, local variables, and custom information for each event Records exceptions for later review
    3. 3. Historical Debugging with IntelliTrace Demo
    4. 4. What Exactly Is Collected? Method parameters Method return values Reference type local variables For each referenced object, whether or not it was there (but not its contents) void ReadTweets(string account) { List<Tweet> tweets = GetTweets(account, 10); int count = 3; for (int i = 0; i < count; ++i) DisplayTweet(tweets[i]); }
    5. 5. Customizing The Events Collection
    6. 6. Collecting IntelliTrace Logs Visual Studio can save logs from every run under IntelliTrace By default at C:ProgramDataMicrosoft Visual Studio<VERSION>TraceDebugging IntelliTraceSC.exe launch /cp:plan.xml app.exe PowerShell cmdlets for ASP.NET/SharePoint Microsoft Test Manager integration Microsoft System Center integration
    7. 7. Opening IntelliTrace Logs Demo
    8. 8. IntelliTrace and Windows Azure The only practical way to debug long-standing issues in cloud applications
    9. 9. Collecting IntelliTrace from Windows Azure Demo
    10. 10. Extending IntelliTrace Events Add your own events to CollectionPlan.xml IntelliTrace can generate an event from any method call in your code or framework code Data queries Declarative event formatting from method calls Only basic types supported
    11. 11. Declarative Data Query <DiagnosticEventSpecification> <SettingsName _locID="...">Garbage collection</SettingsName> <Bindings> <Binding> <ModuleSpecificationId>mscorlib</ModuleSpecificationId> <TypeName>System.GC</TypeName> <MethodName>Collect</MethodName> <MethodId>System.GC.Collect(System.Int32):System.Void </MethodId> <ShortDescriptionGC induced</ShortDescription> <LongDescription>GC of gen {0}.</LongDescription> <DataQueries> <DataQuery index="0" type="Int32" query="" /> </DataQueries> </Binding> </Bindings> </DiagnosticEventSpecification>
    12. 12. Programmability Handlers Custom code that formats event information Consult Microsoft.VisualStudio.DefaultDataQueries.dll for inspiration (undocumented)
    13. 13. Programmable Data Query <DiagnosticEventSpecification enabled="true"> <CategoryId>gesture</CategoryId> <SettingsName _locID="...">Text Changed</SettingsName> <Bindings> <Binding> <MethodId>DiagnosticControls.DiagnosticTextBox. set_DiagnosticText(System.String):System.Void </MethodId> <ProgrammableDataQuery> <ModuleName>WinFormsDataQueries.dll</ModuleName> <TypeName>DiagnosticTextBoxDataQuery</TypeName> </ProgrammableDataQuery> </Binding> </Bindings> </DiagnosticEventSpecification>
    14. 14. Programmable Handler public class DiagnosticTextBoxDQ : IProgrammableDataQuery { public object[] EntryQuery(object thisArg, object[] args) { return new object[] { _nameProperty.GetValue(thisArg, null), _textProperty.GetValue(thisArg, null) }; } public object[] ExitQuery(object returnValue) { return null; } public string FormatShortDescription(object[] results) { return string.Format("Text changed for textbox {0}", results[0].ToString()); } //More methods to format and store the collected data }
    15. 15. Summary IntelliTrace is super-useful inside Visual Studio while debugging You can also collect IntelliTrace data from QA, cloud, and production environments http://msdn.microsoft.com/library/hh398365 You can extend IntelliTrace with your own events
    16. 16. Questions Sasha Goldshtein CTO, SELA Group @goldshtn blog.sashag.net

    ×