Tag Archives: system.diagnostics

A case of a deadlock in a .NET application

I recently had an interesting issue in one of our applications. The SMS router, responsible for sending and receiving SMSes, hanged – there was no CPU usage and we haven’t observed any activity in the application logs. I collected a full memory dump and restarted the service, which seemed to come back to its normal state. Curious what happened I opened the dump in WinDbg, loaded PDE and SOS and started an investigation

Continue reading A case of a deadlock in a .NET application

Timeouts when making web requests in .NET

In one of our applications I recently observed timeouts in code performing HTTP requests to the REST service. While investigating this issue I discovered few interesting facts about System.Net namespace and would like to share them with you. We were using objects of type System.Net.HttpWebRequest in our code, but some of the information presented in this post will also apply to the newer System.Net.HttpClient implementation.

Continue reading Timeouts when making web requests in .NET

How to debug Windows Services written in .NET? (part I)

Diagnosing Windows Services might sometimes be cumbersome – especially when errors occur during the service start. In this two-parts series I am going to show you different ways how to handle such problems in production. In the first part we will focus on “exceptions discovery” techniques which very often are enough to figure out why our service is not working. In the second part we will setup a debugging environment and attach a debugger to our service. Let’s start then.

Continue reading How to debug Windows Services written in .NET? (part I)

Using MySql database to save .NET traces

I’m a great fan of the Essential.Diagnostics and this post will be again committed to this library. In our company we use MS SQL Server as our main database server and an instance of MySql to store logs from applications. If you are using System.Diagnostics tracing you probably lack more advanced trace listeners (like the ones provided by log4net). A remedy for this problem might be the aforementioned Essential.Diagnostics library. In this short post I will show you how to configure the SqlDatabaseTraceListener to work with MySql database.

Continue reading Using MySql database to save .NET traces

Grouping application traces using ActivityId (System.Diagnostics)

I don’t need to stress how tracing (logging) is important in any application. Without logs we are often unable to diagnose the cause of the failure. Logs also help us track application behavior and usage over time. Fortunately there are numerous libraries (including .NET framework itself) that can help us create meaningful logs. In this post I would like to show you how to, using System.Diagnostics classes, nicely group application traces by activities to which they correspond.
Continue reading Grouping application traces using ActivityId (System.Diagnostics)