You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 10, 2020. It is now read-only.
If you are reporting bug/issue, please provide detailed Repro instructions.
Issue description
Using .UseApplicationInsights or .AddApplicationInsightsTelemetry during WebHostBuilder phase and then adding\customizing the TelemetryConfiguration later on during Startup(e.g. adding TelemetryInitilializers) will result into any customization done during Startup.cs phase not work at all.
is uncommented in Program.cs, NullTelemetryInitializer will not be called for auto tracked events like requests, dependencies etc. However if the line is moved to Startup.cs and removed from Program.cs the initializer is called as expected.
Root Cause
If the registration is done during WebHostBuilder phase the whole init is done twice, once when the server is booting up and once for actual operations.
Code in ActiveSubscriptionManager.cs will register the very first time and then retain the instance and call this instance when events happen, this means the second instance is never used which has customizations from WebHostBuilder + Startup.cs.
Version Info
SDK Version (version of https://www.nuget.org/packages/Microsoft.ApplicationInsights.AspNetCore) : 2.7.1
.NET Core Version (TargetFramework in your .csproj file) : .NetCore2.1 and above
How Application was onboarded with SDK(Installed Nugets/VisualStudio/Azure WebAppExtension) : N/A
OS : N/A
Hosting Info (IIS/Azure Web Apps/Running From Visual Studio etc) : N/A
The text was updated successfully, but these errors were encountered:
This is expected and unfortunately cannot be fixed. Some history #621 and microsoft/ApplicationInsights-dotnet-server#1013. We do not support having two different configurations with different settings in one process.
We can only advise you not to do this or dispose the first configuration and all the modules once you are done with them.
If you are reporting bug/issue, please provide detailed Repro instructions.
Issue description
Using
.UseApplicationInsights
or.AddApplicationInsightsTelemetry
during WebHostBuilder phase and then adding\customizing the TelemetryConfiguration later on during Startup(e.g. adding TelemetryInitilializers) will result into any customization done during Startup.cs phase not work at all.Repro
DiagnosticListenerBugAI.zip
If the line
is uncommented in
Program.cs
,NullTelemetryInitializer
will not be called for auto tracked events like requests, dependencies etc. However if the line is moved toStartup.cs
and removed fromProgram.cs
the initializer is called as expected.Root Cause
If the registration is done during WebHostBuilder phase the whole init is done twice, once when the server is booting up and once for actual operations.
Code in ActiveSubscriptionManager.cs will register the very first time and then retain the instance and call this instance when events happen, this means the second instance is never used which has customizations from WebHostBuilder + Startup.cs.
Version Info
SDK Version (version of https://www.nuget.org/packages/Microsoft.ApplicationInsights.AspNetCore) : 2.7.1
.NET Core Version (TargetFramework in your .csproj file) : .NetCore2.1 and above
How Application was onboarded with SDK(Installed Nugets/VisualStudio/Azure WebAppExtension) : N/A
OS : N/A
Hosting Info (IIS/Azure Web Apps/Running From Visual Studio etc) : N/A
The text was updated successfully, but these errors were encountered: