330 likes | 520 Views
DEV354 Visual Studio 2005: New Enhancements For Debugging Applications . Habib Heydarian (habibh) Scott Nonnenberg (scottno) Program Managers Microsoft Corporation. What We’ve Heard…. It’s difficult to view data Too many windows Hard to find the data I want.
E N D
DEV354Visual Studio 2005: New Enhancements For Debugging Applications Habib Heydarian (habibh) Scott Nonnenberg (scottno) Program Managers Microsoft Corporation
What We’ve Heard… • It’s difficult to view data • Too many windows • Hard to find the data I want I don’t know what my code is doing Multi-threaded debugging is hard I need to debug XSL Transforms
Visual Studio 2002/2003 • Many windows to look at data • Autos • Locals • Watch • QuickWatch • Etc.
DataTips In 2002/2003 • DataTips are great but not enough: • Good for viewing simple data • Not good for complex objects • Have to switch to other windows to view complex objects
DataTips In 2005 • The all-in-one debugging tool! • Code in the editor, debug in the editor
DataTips Scott NonnenbergProgram Manager Visual C#
Viewing Data In 2002/2003 • Challenge: • Properties versus fields? • Static members versus non-static members?
Viewing Data Scott NonnenbergProgram Manager Visual C#
Screen Real Estate • Duplicate information Useful information! • In 2002 and 2003 • Use mcee_cs.dat • In VS 2005 • Use attributes to customize the debugger [assembly: DebuggerDisplay ( "File={_fileName} Pos={_pos}", Target=typeof(System.IO.FileStream) )] <System.IO.FileStream>=File=<_fileName> Pos=<_pos>
Too Much Information • Internal implementation may not be useful when debugging • In Visual Studio 2003: Special case • ArrayList, Hashtable • In Visual Studio 2005 • Use attributes to customize the debugger • Default views for most collections • Extensible
Hierarchical View Not Enough • Data windows only show hierarchical view • Not ideal for viewing some types • DataSet • Image • XML • In Visual Studio 2005 • Debugger Visualizers to the rescue!
Making Data Easier To View Scott NonnenbergProgram Manager Visual C#
Tracepoints • Breakpoints and Tracing rolled into one • Trace + Breakpoint = Tracepoint • Instrument your application without changing code • When a Tracepoint is hit, you can • Print a message • Message goes to the Output Window • Run a Visual Studio macro • Same familiar interface as a breakpoint
Tracepoints Scott NonnenbergProgram Manager Visual C#
TracepointsMessage Syntax • Any string “Hello World” Any valid expression {firstName} Predefined messages like $FUNC, $TID “{$FUNC}” Any combination of the above “ID = {this.ID} in function {$FUNC}”
Breakpoint Filters • Advanced feature for debugging • Distributed applications • Multi-process applications • Multi-threaded applications • Filter breakpoints by • Process ID or name • Thread ID or name • Machine name
Multi-Threaded Debugging Scott NonnenbergProgram Manager Visual C#
Debugging XSL Transforms • You can now debug XSL Transformations inside Visual Studio • Two ways to do this: • Debug a standalone XSLT document • Use XML->Debug XSL to start the debugger • Debug an XSLT document loaded by an app • Step Into XSLTProcessor.Execute() • Use normal debugger functionality, e.g., Watch, Stepping, etc.
Debugging XSL Transforms Scott NonnenbergProgram Manager Visual C#
Developer Centers on MSDN http://msdn.microsoft.com/vcsharp http://msdn.microsoft.com/vbasic http://msdn.microsoft.com/visualc http://msdn.microsoft.com/vjsharp Debugger Team Blogs http://blogs.msdn.com/scottno http://msdn.microsoft.com/vcsharp/team/blogs/#debugger
Please fill out a session evaluation on CommNet Q1: Overall satisfaction with the session Q2: Usefulness of the information Q3: Presenter’s knowledge of the subject Q4: Presenter’s presentation skills Q5: Effectiveness of the presentation
© 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
DataTipsNavigation • Via mouse • Display DataTip: move mouse over variable • Expand item: move mouse over ‘+’ (don’t need to click) • Collapse item: click mouse over ‘-’ OR move mouse off current expansion • Via keyboard • Expand item: → • Collapse item: ← • Move up/down: ↑↓
DataTipsScrolling • Vertical scroll bar appears if > 15 items in DataTip • Via Mouse • Single-click on arrow to scroll up/down • Use mouse wheel to scroll up/down • Hover mouse over arrow to auto-scroll • Via Keyboard • Page Up/Page Down to scroll 15 items at a time • Up Arrow, Down Arrow to scroll 1 item at a time
DataTipsEditing • To go into edit mode: • Single-click on variable name or value OR • Right-click item and select “Edit Value” from shortcut menu • Press ENTER to apply edit and exit edit mode • Press ESC to undo edit and exit edit mode • Other debugger windows are updated with new value
DataTipsTips and Tricks • See your code underneath a DataTip • Press CTRL to make a DataTip temporarily transparent! • Add a variable in a DataTip to the Watch window • Right-click variable and select “Add Watch”