.NET Instrumentation Workshop
This is a self paced workshop designed to teach you what instrumentation is, why you will want to use it and how to instrument your .NET code.
This Workshop Will Teach You
- Conditional Code
- .NET Trace Sources and Trace Listeners
- Performance Counters
- The Event Log
There are two main uses for instrumentation: one is strictly for debug mode, the other is for both debug and release mode. During the testing and debug phase of your application development you will want to trace values to give you an idea about what code is called and what values are being generated. This information is of no use whatsoever to anyone outside of your development team and hence such information should only be generated in debug mode. The other use of instrumentation is to log information while your application runs. Such logging should be restrictive and typically will log critical information. It is vital to realise the difference between the two.
This workshop will lead you through all the kinds of instrumentation and help you decide the best way to instrument your code.
The example code for this workshop can be found here.
This workshop was originally written for .NET version 2.0 on Windows XP. Since then Microsoft have released 'version 3.0' of the .NET framework. However (with a few minor changes), this is merely version 2.0 distributed with the WinFX library. This means that in most cases .NET 2.0 and .NET 3.0 are interchangeable. When I say version 3.0 you can assume that I also mean version 2.0. Many of the features are also available with 1.0 and 1.1 but the features may be restricted compared to 2.0. If I do not mention a version then you should assume that the text refers to all versions of .NET which means 3.0, 2.0, 1.1 and 1.0.
The demonstrations will use the command line tools provided by the .NET SDK and the code will be written in C#. The example code can easily be converted to other .NET languages and can easily be converted to VS.NET projects.
The examples in this workshop will use the following tools:
||The C# compiler|
||The Fusion log viewer|
||The GAC utility|
||The IL disassembly tool|
||Program maintenance utility|
||The strong name generator|
<CORFolder> is the location of the .NET framework assemblies
is the location of the .NET SDK (usually it is in the Visual Studio folder). To
do the examples in the workshop you should ensure that your command line path is
set to give access to the folders in the table. The simplest way to do this is
to run the
vsvars32.bat file in the
folder in the Visual Studio .NET folder.
There is no charge for this tutorial, if this workshop was published as a book then you would pay $50 for it, if I were to give you this workshop as a training session then you would have to pay several thousand dollars, instead, you get it entirely for free. If you want to show your appreciation for the effort I have put into this workshop then please consider making a donation through Paypal.
I give training courses and conference talks, and I write white papers and books on a variety of .NET topics; I also architect systems and perform code reviews. Please contact me if you want me to provide my services for you.
4. Trace Listeners
4.1 Framework Trace Listeners
4.5 .NET 2.0 Trace Listeners
4.6 Redirecting Console Streams
4.7 VB.NET Logging
7. Performance Counters
7.1 Performance Monitor Example
7.2 Performance Monitor Registration
7.3 Reading .NET Performance Counters
7.4 Providing .NET Performance Counters
7.5 Performance Counter Installers
8. Event Log
8.1 The Event Log Architecture
8.2 What Is The Event Log For?
8.3 The Event Log Viewer
8.4 Reading The Event Log
8.5 Event Messages
8.6 How Microsoft Wants You To Write To The Event Log
8.7 The Right Way To Write To The Event Log
8.8 More About Reporting Events
8.9 Event Log Installers
8.10 What Should You Log?
|I hope that you enjoy this tutorial and value the knowledge that you will gain from it. This tutorial is free and will always remain free.|