title: Application Insights not logging custom events
body: <p>I have setup Application Insights in my ASP.NET Core application in the C# Controller and it is logging basic data like Page Views, Response Time, etc.  But I want to create some custom events and log those as well, but I cannot get any oft he Custom Events to show up in the Azure portal.  Currently I'm using the Free version of Application Insights.</p>
  
  <p>The is very straight forward</p>
  
  <pre><code>var appInsights = new TelemetryClient();
  appInsights.TrackEvent(eventName, properties);
  </code></pre>
  
  <p>Where the eventName is a string containing the custom event that I want to track and properties is a Dictionary to track some additional properties.</p>
  
  <p>After I run the app and hit those lines a couple of times I can then go to the azure portal and see the basic information, but when I do a Search it says that there is 0 Custom Events and searching for any of the custom events by name returns no results.</p>
  
  <p>I have a class that has the Telemetry stuff in it below</p>
  
  <pre><code>public class ApplicationInsightsTracker : IApplicationTracker
  {
  
      private readonly TelemetryClient AppInsights = new TelemetryClient();
  
      public void TrackEvent(string eventName, string userName, Dictionary&lt;string, string&gt; properties = null)
      {
          AppInsights.Context.User.AccountId = userName;
          TrackEvent(eventName, properties);
      }
  
      public void TrackRequest(string eventName, string userName, TimeSpan elapsed,
          Dictionary&lt;string, string&gt; properties = null)
      {
          AppInsights.Context.User.AccountId = userName;
          TrackEvent(eventName, properties);
  
          AppInsights.TrackRequest(eventName, DateTimeOffset.Now, elapsed, "200", true);
          AppInsights.Flush();
      }
  
      private void TrackEvent(string eventName, IDictionary&lt;string, string&gt; properties = null)
      {
          AppInsights.TrackEvent(eventName, properties);
          AppInsights.Flush();
      }
  
  }
  </code></pre>
  
  <p>Then a simple example of me using it is</p>
  
  <pre><code>        Tracker.TrackEvent("Visit HomePage", User.Identity.Name);
  </code></pre>
  
  <p>Edit:  The above event is working, but the below one is not, it is not logging this one at all.  This calls the TrackRequest and also the TrackEvent on the TelementryClient, but I'm not seeing these at all.</p>
  
  <pre><code>    Tracker?.TrackRequest("Drill Report", userName, stopwatch.Elapsed, 
          new Dictionary&lt;string, string&gt;
          {
              { "DrillBy", report.DrillBy == null ? "None" : report.DrillBy.FriendlyName }
          });
  </code></pre>
  
  <p>I somewhat take that back.  I am seeing some of these events come through, but I logged a bunch of them back to back and I only see 2 of the 6 that I should be seeing?  Any ideas what could be going on?</p>