Presentation is loading. Please wait.

Presentation is loading. Please wait.

DEV450 Visual Studio: Best Practices For Debugging Managed Applications Habib Heydarian Scott Nonnenberg Program Managers Microsoft Corporation.

Similar presentations


Presentation on theme: "DEV450 Visual Studio: Best Practices For Debugging Managed Applications Habib Heydarian Scott Nonnenberg Program Managers Microsoft Corporation."— Presentation transcript:

1 DEV450 Visual Studio: Best Practices For Debugging Managed Applications Habib Heydarian Scott Nonnenberg Program Managers Microsoft Corporation

2 Overview Setting up for debugging Environment Symbol server JIT debugging ASP.NET Debugging Web Applications Web Services Debugging SQL Server Instrumentation and Tracing

3 Setting Up For Debugging Generate a debug build Generates debugging info (pdb file) F5 or attach Customize F5 Remote launch Launch URL Launch executable Launch debuggers

4 Remote Debugger Setup 1.Setup debug components on remote machine Remote Debugging 2. Add user to Debugger Users group 3. Typically user needs to be admin Local MachineRemote Machine

5 Remote Debugging And Windows XP SP2 How to enable remote debugging on Windows XP Service Pack 2 Need to configure Internet Connection Firewall (ICF) Also need to configure DCOM if not admin on remote machine Further details @ http://msdn.microsoft.com/library/en- us/dnwxp/html/xpsp2remotedebug.asp http://msdn.microsoft.com/library/en- us/dnwxp/html/xpsp2remotedebug.asp http://msdn.microsoft.com/library/en- us/dnwxp/html/xpsp2remotedebug.asp

6 Symbol Server New Feature for 7.1 Automatically finds symbols from indexed symbol stores Automatically finds binaries too (for reading minidumps) Uses weird symbol path syntax Not officially supported in 7.0, but Get symsrv.dll from web (see later) Copy symsrv.dll next to devenv.exe “srv*” -> “symsrv*symsrv.dll*”

7 Symbol Server Path Syntax Goes in Project Properties, Symbol Path For minidumps, add command argument: MODPATH= srv*[localcache*]remotepath Remote path can be UNC path (internal) or http: address (external) A local cache makes things much faster after the first time

8 JIT Debugging “Just In Time” (JIT) Debugging Allows you to debug crashes (exceptions) when application is not running under the debugger Default is off for Windows Forms Can select which debugger to attach with <configuration> </configuration>

9 Debugging Script Client-side script Standalone script wscript.exe Test.vbs //X (or //D) Script running in a Web Application Use Running Documents window Server-side script Classic ASP pages Some configuration required

10 Debugging Script Scott Nonnenberg Program Manager Visual Studio Debugger

11 Testing Your ASP.NET Application Using Different Browsers Visual Studio always uses Internet Explorer when debugging an ASP.NET application What if you want to debug using other browsers?

12 Using A Non-Internet Explorer Browser For Debugging Scott Nonnenberg Program Manager Visual Studio Debugger

13 Multi-Developer Debugging On Internet Information Server 6.0 With Internet Information Server 6.0 (IIS 6.0), multiple developers can debug on the same Web Server Three steps required: Create an application pool Configure the application pool Change the properties for the web application to use the new application pool

14 Multi-Developer Debugging On IIS 6.0 Habib Heydarian Program Manager Visual Studio Debugger

15 Enterprise Production Debugging Visual Studio supports production debugging via: Dumps and NTSD extensions (SOS.dll) “Live” remote debugging

16 Using SOS To Debug Dumps What is SOS? “Son of Strike” NTSD extension What is it used for? Debugging memory leaks Debugging contention (deadlock) issues Debugging unexpected process termination

17 Using SOS Habib Heydarian Program Manager Visual Studio Debugger

18 Debugging XML Web Services You can debug an XML Web Service: On its own Called from a ASP.NET Web Form Called from a client application That is already running

19 Debugging XML Web Services Scott Nonnenberg Program Manager Visual Studio Debugger

20 SQL Server Debugging Two ways 1. Use Server Explorer Debug stored procedures and functions 2. Call procedure from application Set breakpoint Enable SQL debugging

21 Debugging SQL Server Habib Heydarian Program Manager Visual Studio Debugger

22 Code Instrumentation Options Do-it-yourself (not recommended).NET Tracing System.Diagnostics ASP.NET Tracing Enterprise Instrumentation Framework

23 Tracing In.NET Available for all.NET application types System.DiagnosticsDebugTrace Conditionally compiled Extensible output via TraceListeners File, Debugger, Event Log Configured via file (.config)

24 ASP.NET Tracing Configuration:Page-level Application-level (trace.axd) web.config Outputs to browser

25 ASP.NET Tracing

26 Enterprise Instrumentation Framework Available on MSDN Very extensible Events, EventCategories FiltersEventSinks Event Log, WMI, Windows Trace Service Configuration via file Read at startup and when changed Scriptable API

27 .NET Tracing Versus EIF.NETEIF On-the-fly Configuration NoYes Extensible Event Types NoYes Separate Installation Required NoYes Performance Overhead YesYes Output Shown in Debugger YesNo

28 Enterprise Instrumentation Framework Demo Scott Nonnenberg Program Manager Visual Studio Debugger

29 Enterprise Instrumentation Framework http://msdn.microsoft.com/vstudio/productinfo/enterprise/eif/ 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

30 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 Please fill out a session evaluation on CommNet

31 Questions?

32 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.


Download ppt "DEV450 Visual Studio: Best Practices For Debugging Managed Applications Habib Heydarian Scott Nonnenberg Program Managers Microsoft Corporation."

Similar presentations


Ads by Google