| I l @ ve RuBoard |
Conclusion
As you've seen in this chapter, Visual Basic .NET implements its security infrastructure via the key
A frequently
|
| I l @ ve RuBoard |
| I l @ ve RuBoard |
Part III: Performance and Debugging
Essential Debugging Techniques Common Performance Issues The Art of Performance Tuning |
| I l @ ve RuBoard |
| I l @ ve RuBoard |
Chapter 10. Essential Debugging Techniques
The techniques used to debug Microsoft Visual Basic .NET are varied and can be quite complex. In addition to the simple concept of a debugger, the .NET Framework also provides a set of tools that you can leverage to diagnose and instrument your applications. The essence of debugging is to discover the root cause of a failure. In certain situations, this can be a simple process and debuggers can be extremely helpful tools. But
I'll first give you an overview of the common Windows debuggers. Then we'll look at what you can do within your own applications to leverage the .NET Framework to simplify not only debugging but also diagnosing general application problems and failures. This is of critical importance when you either don't have debuggers available or the debuggers alone are not helpful in tracking down problems. |
| I l @ ve RuBoard |
| I l @ ve RuBoard |
|
|
Debugger |
Type |
Managed |
Native |
|---|---|---|---|
|
Visual Studio .NET |
GUI |
|
|
|
CorDbg |
Console |
|
|
|
DbgClr |
GUI |
|
|
|
CDB |
Console |
|
|
|
NTSD |
Console |
|
|
|
WinDbg |
Console/GUI |
|
Why
If you're interested only in debugging managed code, CorDbg and DbgClr are great choices. Both of these debuggers are available with the .NET Framework SDK. You can install the SDK with Visual Basic .NET, but the SDK is also available in standalone form.
The native debuggers are designed ”surprise ”to debug only native applications. All of these debuggers can be
The Microsoft Common Language Runtime (CLR) Debugger (DbgClr.exe) is a managed GUI debugger. If you're most comfortable with a GUI system instead of a console-based application, the CLR Debugger is a great choice. Even if you aren't familiar with debugging managed applications, this debugger can be a great tool to help you learn the
The CLR Debugger is actually a subset of the Visual Studio .NET Debugger, so the interface should look somewhat familiar ”see Figure 10-2 ”but it is more lightweight and doesn't require installation of Visual Studio .NET (quite an advantage). It is a very capable managed debugger and is easy to use. If you're already comfortable with the Visual Studio .NET debugger, you'll be immediately comfortable with this tool.
Unfortunately, this debugger is not without its limitations. Because it is only a subset of the Visual Studio .NET Debugger, it does not support all of the parent debugger's features. For example, it does not support remote debugging or native code debugging, and the Disassembly and Register windows aren't very useful.
CorDbg is a console-based managed debugging tool. (See Figure 10-3.) I love using this debugger,
CorDbg is so named because it is an application that implements the ICorDebug set of debugging interfaces. If you have the .NET Framework SDK installed, you'll discover a wealth of low-level debugging samples and information. Microsoft even ships the source code for this tool so you can learn how the runtime debug API can be used. Unfortunately, the examples are in Visual C++ and are well beyond the scope of this text.
The Microsoft Console Debugger (CDB) and Microsoft NT Symbolic Debugger (NTSD) are both console-based and are
NTSD and CDB are not for casual debugging. Many of the commands and operations are
The Microsoft Windows Debugger (WinDbg), shown in Figure 10-5, is a GUI-based debugger built on the foundation of the CDB and NTSD console debuggers. It is quite powerful and can be used to view source code, breakpoints, call stack, and so forth. Thanks to its GUI interface, more of the debugging features are more accessible to the casual user than with CDB or NTSD. This debugger's help system, although not always complete, makes the debugger much easier to use.
Although WinDbg is a GUI-based debugger, you can also use it from the command line. This is more of an advanced feature, so you should first attain a degree of
| I l @ ve RuBoard |