C# Other
Latest commit f5ff412 Feb 17, 2017 @SergeyKanzhelev SergeyKanzhelev committed on GitHub Merge pull request #437 from Microsoft/sergkanz/TaskTimerDeprecation
Sergkanz/task timer deprecation
Failed to load latest commit information.
Schema added node name field Oct 18, 2016
Test Merge pull request #437 from Microsoft/sergkanz/TaskTimerDeprecation Feb 17, 2017
docs Add table of contents Jul 15, 2016
src Merge pull request #437 from Microsoft/sergkanz/TaskTimerDeprecation Feb 17, 2017
.gitattributes Adding gitattributes Feb 5, 2016
.gitignore Change version format from x.x.x.x to x.x.x-x Jun 1, 2016
35MSSharedLib1024.snk add public key file Sep 28, 2015
AddXmlLanguage.targets forgotten commit Sep 26, 2016
ApplicationInsightsSDKRules.ruleset Added rules and enabled code analysis on build. Aug 12, 2016
CHANGELOG.md Update changelog Feb 17, 2017
CodeCov.ps1 Add server channel back Feb 19, 2016
Common.props Revert changes to file version Sep 19, 2016
Common.targets Added targets to update the XML docs post build with a language attri… Sep 6, 2016
EnlistmentRoot.marker Restructuring the Core SDK and CoreSDK Tests to fit the GitHub structure Jul 13, 2015
Global.props Revert changes to global.props Sep 19, 2016
GlobalStaticVersion.props Updated version number to 2.3.0-beta2. (#421) Feb 3, 2017
LICENSE Create License Sep 14, 2015
Microsoft-Security-Recommended.ruleset Added rules and enabled code analysis on build. Aug 12, 2016
Microsoft.ApplicationInsights.sln update stylecop and removed server channel testframework completely Feb 7, 2017
NuGet.config Added rules and enabled code analysis on build. Aug 12, 2016
NuGet.exe Modify package to target netstandard1.5 Nov 17, 2016
NuGet.targets allow to build with toolset 12.0 Oct 13, 2015
Package.targets mergd solutions Feb 7, 2017
PushNugetPackages.cmd fix uploading to myget Oct 23, 2015
README.md Fix typos in README.md Jan 13, 2017
Signing.targets fix initial project loading Sep 29, 2015
Test.props Restructuring the Core SDK and CoreSDK Tests to fit the GitHub structure Jul 13, 2015
VSOPushNugetPackages.cmd Whitespace corrections Jan 22, 2016
buildDebug.cmd missed commits Sep 26, 2016
buildRelease.cmd missed commits Sep 26, 2016
dirs.proj mergd solutions Feb 7, 2017


Build Status Nuget codecov.io

Application Insights for .NET

This repository has code for the core .NET SDK for Application Insights. Application Insights is a service that allows developers ensure their application are available, performing, and succeeding. This SDK provides the core ability to send all Application Insights types from any .NET project.

Getting Started

If developing for a .Net project that is supported by one of our platform specific packages, Web or Windows Apps, we strongly recommend to use one of those packages instead of this core library. If your project does not fall into one of those platforms you can use this library for any .Net code. This library should have no depenedencies outside of the .Net framework. If you are building a Desktop or any other .Net project type this library will enable you to utilize Application Insights.

Get an Instrumentation Key

To use the Application Insights SDK you will need to provide it with an Instrumentation Key which can be obtained from the portal. This Instrumentation Key will identify all the data flowing from your application instances as belonging to your account and specific application.

Add the SDK library

We recommend consuming the library as a NuGet package. Make sure to look for the Microsoft.ApplicationInsights package. Use the NuGet package manager to add a reference to your application code.

Initialize a TelemetryClient

The TelemetryClient object is the primary root object for the library. Almost all functionality around telemetry sending is located on this object. You must initialize an instance of this object and populate it with your Instrumentation Key to identify your data.

using Microsoft.ApplicationInsights;

var tc = new TelemetryClient();
tc.InstrumentationKey = "INSERT YOUR KEY";

Use the TelemetryClient to send telemetry

This "core" library does not provide any automatic telemetry collection or any automatic meta-data properties. You can populate common context on the TelemetryClient.context property which will be automatically attached to each telemetry item sent. You can also attach additional propety data to each telemetry item sent. The TelemetryClient also exposes a number of Track...() methods that can be used to send all core telemetry types understood by the Application Insights service. Some example use cases are shown below.

tc.Context.User.Id = Environment.GetUserName(); // This is probably a bad idea from a PII perspective.
tc.Context.Device.OperatingSystem = Environment.OSVersion.ToString();


tc.TrackEvent("PurchaseOrderSubmitted", new Dictionary<string, string>() { {"CouponCode", "JULY2015" } }, new Dictionary<string, double>() { {"OrderTotal", 68.99 }, {"ItemsOrdered", 5} });

catch(Exception e)

Ensure you don't lose telemetry

This library makes use of the InMemoryChannel to send telemetry data. This is a very lightweight channel implementation. It stores all telemetry to an in-memory queue and batches and sends telemetry. As a result, if the process is terminated suddenly, you could lose telemetry that is stored in the queue but not yet sent. It is recommended to track the closing of your process and call the TelemetryClient.Flush() method to ensure no telemetry is lost.

Full API Overview

Read about how to use the API and see the results in the portal.


  • master contains the latest published release located on NuGet.
  • develop contains the code for the next release.


We strongly welcome and encourage contributions to this project. Please read the contributor's guide located in the ApplicationInsights-Home repository. If making a large change we request that you open an issue first. We follow the Git Flow approach to branching.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.