If you are reporting bug/issue, please provide detailed Repro instructions.
Repro Steps
var exception = new System.Exception();
exception.Data["foo"] = null;
throw exception;
Actual Behavior
Response exception in middleware: System.AggregateException: An error occurred while writing to logger(s). (Object reference not set to an instance of an object.) ---> System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.ApplicationInsights.AspNetCore.Logging.ApplicationInsightsLogger.<>c__DisplayClass9_01.<Log>b__0(DictionaryEntry item) at System.Collections.Generic.List1.ForEach(Action1 action) at Microsoft.ApplicationInsights.AspNetCore.Logging.ApplicationInsightsLogger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func3 formatter) at Microsoft.Extensions.Logging.Logger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func3 formatter) --- End of inner exception stack trace --- at Microsoft.Extensions.Logging.Logger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func3 formatter) at Microsoft.Extensions.Logging.LoggerExtensions.Log(ILogger logger, LogLevel logLevel, EventId eventId, Exception exception, String message, Object[] args) at Microsoft.Extensions.Logging.LoggerExtensions.LogError(ILogger logger, EventId eventId, Exception exception, String message, Object[] args)
Expected Behavior
Logs an exception
Version Info
SDK Version : 2.5.1
.NET Version : .NET core 2.2
How Application was onboarded with SDK(VisualStudio/StatusMonitor/Azure Extension) :
OS : Windows
Hosting Info (IIS/Azure WebApps/ etc) :
If you are reporting bug/issue, please provide detailed Repro instructions.
Repro Steps
Actual Behavior
Response exception in middleware: System.AggregateException: An error occurred while writing to logger(s). (Object reference not set to an instance of an object.) ---> System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.ApplicationInsights.AspNetCore.Logging.ApplicationInsightsLogger.<>c__DisplayClass9_0
1.<Log>b__0(DictionaryEntry item) at System.Collections.Generic.List1.ForEach(Action1 action) at Microsoft.ApplicationInsights.AspNetCore.Logging.ApplicationInsightsLogger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func3 formatter) at Microsoft.Extensions.Logging.Logger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func3 formatter) --- End of inner exception stack trace --- at Microsoft.Extensions.Logging.Logger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func3 formatter) at Microsoft.Extensions.Logging.LoggerExtensions.Log(ILogger logger, LogLevel logLevel, EventId eventId, Exception exception, String message, Object[] args) at Microsoft.Extensions.Logging.LoggerExtensions.LogError(ILogger logger, EventId eventId, Exception exception, String message, Object[] args)Expected Behavior
Logs an exception
Version Info
SDK Version : 2.5.1
.NET Version : .NET core 2.2
How Application was onboarded with SDK(VisualStudio/StatusMonitor/Azure Extension) :
OS : Windows
Hosting Info (IIS/Azure WebApps/ etc) :