|
1
|
|
|
2
|
- What’s new
- Debugging
- .NET applications
- asp.net
- SQL Server
- Cross language
- Instrumentation
- Hidden goodies
|
|
3
|
- Unified user interface
- No memory leaks
- Leaks and corruptions are a thing of the past!
- Real remote debugging
- Single step from client to server, to server, to server!
- Attach and detach from running servers
- Debug production servers without killing them!
- Cross-language debugging
|
|
4
|
- The UI has improved dramatically
- Breakpoints dialog is dockable
- Multiple memory windows (finally!)
- More breakpoint modifiers
- Changes are for both managed and unmanaged code
|
|
5
|
|
|
6
|
- For ASP.NET with script on the pages
- For a single page, use Page directive
- Set application-wide debugging in Web.Config
|
|
7
|
- For WINFORMS and ASP.NET compiled components
|
|
8
|
- Same as today
- Customize F5
- Remote launch
- Launch URL
- Launch executable
- Launch debuggers
|
|
9
|
- Must specify host process
- Specify host in project properties, or
- Manually attach
- “Additional DLL’s” improvement!
|
|
10
|
- “Just In Time” debugging
- Exception occurs - automatic attach
- Default is off for Windows Forms
- Machine.Config or Application.Exe.Config
- Debugger choice
|
|
11
|
- Two ways
- Compile with /debug
- Generates debugging info (pdb file)
- Launch then attach
- Open your exe as a project
|
|
12
|
|
|
13
|
- F5 – just works
- Automatic attach to Web server process
- To debug running applications
- Manually attach to asp.net
- Typically “aspnet_wp.exe”
- Detach from process!
|
|
14
|
- F5 – just works
- Launches Web Service “help” page
- Wait for Web Service to be called
- Step into Web Services
|
|
15
|
|
|
16
|
|
|
17
|
- Two ways
- Use server explorer
- Debug stored procedures + functions
- Call procedure from application
- Set breakpoint
- Enable SQL debugging
- Debug into triggers
|
|
18
|
|
|
19
|
- Debug across .NET languages
- Debug from .NET to C++
- Platform Invocation Services (P/Invoke)
- COM Interoperability
- IJW for Managed Extensions for C++
- Debug into TSQL
|
|
20
|
|
|
21
|
|
|
22
|
- System.Diagnostics has two classes for tracing and assertions
- Both classes have identical members
- Only active when conditionally compiled with TRACE and DEBUG,
respectively
- Always build with TRACE defined
|
|
23
|
- Four methods
- Write, WriteIf, WriteLine, WriteLineIf
- *If methods only do output if first parameter evaluates to true
- Allows conditional tracing
- Watch for performance hit with *If
|
|
24
|
|
|
25
|
- In team development, tracing effectiveness can go to zero quickly
- .NET provides the TraceSwitch class
- Allows easy per assembly/module/class tracing
- From the System.Diagnostic namespace
|
|
26
|
- TraceSwitch also allows you to easily set the tracing level to
- 0 - None
- 1 - Errors only
- 2 - Warnings (Errors as well)
- 3 - Info (Warnings and Errors also)
- 4 - Verbose (All traces turned on)
|
|
27
|
- Using a TraceSwitch is trivial
|
|
28
|
- Put the switches in XML configuration files associated with the EXE
- This is the only way to set them
- File name is <program>.EXE.CONFIG
- “name” is the switch name”
- “value” is the numerical value
|
|
29
|
|
|
30
|
- The tracing output is controlled by TraceListeners
- The DefaultTraceListener trace output
- Any attached .NET debugger
- To Win32 OutputDebugString calls
|
|
31
|
- Other TraceListeners
- TextWriterTraceListener
- EventLogTraceListener
- Adding a TraceListener in code is trivial
|
|
32
|
- Since Trace and Debug both have the same methods, which do you use for
tracing?
- Use Trace strictly for tracing
- Each assembly should have it’s own trace switch
|
|
33
|
- Both Trace and Debug objects have an Assert method
- With the DefaultTraceListener, assertion output is to a message box with
full call stack with source and line information
|
|
34
|
- .NET assertions require slightly more typing to get the assertion
information in them
- You have to type the condition twice if you want it to appear in the
message box
|
|
35
|
- You can type multiple messages if you really want
|
|
36
|
- Which Assert method do you use, Debug’s or Trace’s?
- I opt for using Debug’s as assertions are debug compilation features
- Remember:
- Whatever you choose, pick one way and stick with it!
|
|
37
|
- To turn off the default message boxes in <prog>.EXE.CONFIG using
the current TraceListeners
|
|
38
|
- You can also change the output by setting the Debug object
TraceListeners in code
|
|
39
|
- ASP.NET tracing is completely different
- The System.Web.UI.Page object provides a TraceContext object in the
Trace property
- Tracing is disabled by default
|
|
40
|
- At the top of the page add the @Page directive
- Trace.Write and Trace.Warn do the writing
- Output appears at the bottom of the page
- Write appears in black
- Warn appears in red
|
|
41
|
- The <trace> section of Web.Config is where you set the parameters
|
|
42
|
- When pageOutput is false, output goes to the trace log
- Append “trace.axd” onto the applications root directory to view
|
|
43
|
|
|
44
|
- Debugger automation model
- Expand your types automatically
- Mcee_cs.dat for C#
- Mcee_mc.dat for MC++
- UserType.dat
- Reload Symbols
- Exceptions dialog
|
|
45
|
|