title: Application Insights telemetry processor not catching exception
body: <p>I have a custom Telemetry Processor that sends custom exception fields to Application Insights.</p>
  <p>For example if I throw a custom exception like this one</p>
  <pre class="lang-cs prettyprint-override"><code>class MyException : Exception
  {
     public string AdditionalData { get; set; }
  }
  </code></pre>
  <p>then it sends <code>AdditionalData</code> as a custom app insights field.</p>
  <pre class="lang-cs prettyprint-override"><code>public class CustomExceptionDataTelemetryProcessor : ITelemetryProcessor
  {
      /// &lt;summary&gt;
      /// Default exception fields that should be ignore because they are part of logs by default
      /// &lt;/summary&gt;
      private static IEnumerable&lt;string&gt; _DefaultExceptionFields = new Exception().GetType().GetProperties().Select(e =&gt; e.Name);
      private readonly ITelemetryProcessor _next;
  
      public CustomExceptionDataTelemetryProcessor(ITelemetryProcessor next)
      {
          _next = next;
      }
  
      public void Process(ITelemetry item)
      {
          ModifyItem(item);
          _next.Process(item);
      }
  
      /// &lt;summary&gt;
      /// Adds exception fields as custom data
      /// &lt;/summary&gt;
      private void ModifyItem(ITelemetry item)
      {
          if (!(item is ExceptionTelemetry exceptionTelementry))
          {
              return;
          }
  
          var exception = exceptionTelementry.Exception;
          var exceptionType = exception.GetType();
  
          foreach (var property in exceptionType.GetProperties())
          {
              // ignore default fields
              if (_DefaultExceptionFields.Contains(property.Name))
              {
                  continue;
              }
              
              var value = property.GetValue(exception);
              var serializedValue = (value is string) ? value.ToString() : HttpClientUtils.Serialize(value);
              exceptionTelementry.Properties[property.Name] = serializedValue;
          }
      }
  }
  </code></pre>
  <p>I register this processor like this</p>
  <pre class="lang-cs prettyprint-override"><code>var telemetryBuilder = TelemetryConfiguration.Active.TelemetryProcessorChainBuilder;
  telemetryBuilder.Use((next) =&gt; new CustomExceptionDataTelemetryProcessor(next));
  telemetryBuilder.Build();
  </code></pre>
  <p>Everything works fine with <code>Microsoft.ApplicationInsights.AspNetCore</code> version <a href="https://www.nuget.org/packages/Microsoft.ApplicationInsights.AspNetCore/2.2.1" rel="nofollow noreferrer">2.2.1</a>.</p>
  <p>If I upgrade to latest version <a href="https://www.nuget.org/packages/Microsoft.ApplicationInsights.AspNetCore/2.15.0" rel="nofollow noreferrer">2.15.0</a> it still works fine, but I get a warning that the registration code is deprecated so I changed it per the <a href="https://docs.microsoft.com/en-us/azure/azure-monitor/app/api-filtering-sampling" rel="nofollow noreferrer">documentation</a></p>
  <pre class="lang-cs prettyprint-override"><code>services.AddApplicationInsightsTelemetryProcessor&lt;CustomExceptionDataTelemetryProcessor&gt;();
  </code></pre>
  <p>But now the exception doesn't get 'caught' anymore by the processor. Only items of type <code>RequestTelemetry</code> or <code>DependencyTelemetry</code>. No items of type <code>ExceptionTelemetry</code>.</p>
  <p>I could leave the registration with the old way, but thinking that it might be a sign that something is not quite right and might cause other issues elsewhere.</p>
  <p>I tried to remove all initializers and processors before registering my own, but it doesn't help. Something else might be filtering out the exception.</p>
  <pre class="lang-cs prettyprint-override"><code>services.RemoveAll(typeof(ITelemetryInitializer));
  services.RemoveAll(typeof(ITelemetryProcessor));
  </code></pre>