Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ApplicationVersion is overwritten by DOTNET_VERSION of aspnet container images #2898

Open
drauch opened this issue Aug 21, 2024 · 0 comments
Labels

Comments

@drauch
Copy link

drauch commented Aug 21, 2024

  • List of NuGet packages and version that you are using: 2.22.0
  • Runtime version (e.g. net461, net48, netcoreapp2.1, netcoreapp3.1, etc. You can find this information from the *.csproj file): net8.0
  • Hosting environment (e.g. Azure Web App, App Service on Linux, Windows, Ubuntu, etc.): AKS K8s container

Describe the bug

The ApplicationVersion reported to Application Insights is overwritten by the environment variable DOTNET_VERSION which is set in all aspnet Docker containers by Microsoft.

Using the, e.g., /dotnet/aspnet/8.0-nanoserver-1809 image, sets the environment variable DOTNET_VERSION. The ASP.NET Core application's WebHostBuilder by default adds an environment variable configuration provider that strips the "DOTNET_" prefix resulting in a configuration value for "VERSION". The extension method to add Application Insights (in the end calling the internal method Microsoft.Extensions.DependencyInjection.ApplicationInisghtsExtensions.AddTelemetryConfiguration) in turn checks whether there is a configuration value "version" and if so sets the ApplicationVersion property to this version number.

This results in the ASP.NET Core SDK version number being reported as the ApplicationVersion.

Actually this should affect lots of people, it is a mystery to me why this has not been reported yet.

Best regards,
D.R.

@drauch drauch added the bug label Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant