title: Application Insights
body: <p>I have two projects: one is MVC4 application and another is output type class library.</p>
  
  <p>I want to make the second project (the class library one) an insights communication layer.</p>
  
  <p>The code compiles and the server runs normally.</p>
  
  <pre><code>public static void SaveMetric(string title, double value, 
      string azureKey, Dictionary&lt;string, string&gt; properties = null)
  {
      try
      {
          TelemetryClient telemetry = new TelemetryClient();
          telemetry.InstrumentationKey = azureKey;
          telemetry.TrackMetric(title, value, properties);
      }
      catch (Exception ex)
      { 
          var a = "";
      }
  }
  </code></pre>
  
  <p>The problem start's when I call the <code>telemetry.TrackMetric</code> function. This code returns the error: </p>
  
  <blockquote>
    <p>"Object reference not set to an instance of an object."(System.NullReferenceException).</p>
  </blockquote>
  
  <p>Is it possible to use Microsoft Insights in a class library project? And if it is, what am I doing wrong?</p>