Using Application Insights on a Windows Forms Application

Using Telemetry is something great on modern applications.
Most of the telemetry application or examples are for Web applications, but Windows Forms applications can also take advantage of it.

So I decided to make it also super simple to use, by packaging this on a nuget.
It is published at

Application Insight Helper

This is a helper for Windows Forms Applications.
It uses Application Insights to report simple Events like application start and application end
and it can also be used to report other application tasks.

It was inspired by Gerald Barre Post:

This project just provides a nuget to simplify its use.


nuget Install-Package ApplicationInsightsHelper


Quick Start

After installing the nuget, modify your application entry point and insert a call like:


Obviosly you need to change the StartTelemetry parameter for the telemetry key that you get from your
Azure Application Insights settings.

By calling the StartTelemetry, your application start and end event will be automatically tracked. Also
any unhandled exceptions will be registed and send to Application Insights.

Tracking Page Visits

You could modify your Form_Load handlers to add a call to Telemetry.TrackPageVisit("Form1"). This will let
you monitor when a user is using one of your forms.

Tracking Exceptions

This helper will track all unhandled exceptions. However if you want to track some of the exception that you already
catch you can just call Telemetry.TrackException(yourException);

Tracking Events

You can track simple events just by name. For example:


Or you can also record additional parameters:

       Telemetry.TrackEvent("", new Dictionary<string, string> { { "dbName", "ProductionDB1" } });