O'Reilly logo

Professional C# 6 and .NET Core 1.0 by Christian Nagel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

20 Diagnostics and Application Insights

What’s In This Chapter?

  • Simple Tracing with EventSource
  • Advanced Tracing with EventSource
  • Creating a Custom Trace Listener
  • Using Application Insights

Wrox.com Code Downloads for This Chapter

The wrox.com code downloads for this chapter are found at www.wrox.com/go/professionalcsharp6 on the Download Code tab. The code for this chapter is divided into the following major examples:

  • SimpleEventSourceSample
  • EventSourceSampleInheritance
  • EventSourceSampleAnnotations
  • ClientApp/MyApplicationEvents
  • WinAppInsights

Diagnostics Overview

As release cycles for applications become faster and faster, it’s becoming more and more important to learn how the application behaves while it’s running in production. What exceptions are occurring? Knowing what features are used is also of interest. Do users find the new feature of the app? How long do they stay in the page? To answer these questions, you need real-time information on the application.

This chapter explains how to get real-time information about your running application in order to identify any issues that it might have during production or to monitor resource usage to ensure that higher user loads can be accommodated. This is where the namespace System.Diagnostics .Tracing comes into play. This namespace offers classes for tracing using Event Tracing for Windows (ETW).

One way to deal with errors in your application, of course, is by throwing exceptions. However, an application might not ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required