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

Application crash after update from version 3.1.0 to 4.0.0 #207

Open
TinoMSoft opened this issue Sep 7, 2022 · 0 comments
Open

Application crash after update from version 3.1.0 to 4.0.0 #207

TinoMSoft opened this issue Sep 7, 2022 · 0 comments
Labels

Comments

@TinoMSoft
Copy link

Description
I updated the Serilog.Sinks.ApplicationInsights nuget package from version 3.1.0 to 4.1.0 in my ASP.NET Core 6 app. When I start the app (console or web app), the app crashes during startup with a NullReferenceException. This exception doesn't contains any information why this happend.

I investigate my app Serilog setup in Startup.cs and found out, Serilog.Sinks.ApplicationInsights required the AI connection string and no longer the instrumentation key. But my config had still the instrumentation key only.
Microsoft itself reports code warnings to use connection string instead instrumation key. But the app is will work, when I don't do that.

Reproduction
The Serilog config in Startup.cs like before. Add this to your appsettings.json { "Serilog": { "Using": [ "Serilog.Sinks.ApplicationInsights" ], "WriteTo": [ { "Name": "ApplicationInsights", "Args": { "instrumentationKey": "#{ApplicationInsightKey}#", "outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3} {Application}] {Message:lj} {NewLine}{Exception}", "telemetryConverter": "Serilog.Sinks.ApplicationInsights.Sinks.ApplicationInsights.TelemetryConverters.TraceTelemetryConverter, Serilog.Sinks.ApplicationInsights", "restrictedToMinimumLevel": "Warning" } } ] } }

Expected behavior
If a downwards compatibility is impossible, then should Serilog.Sinks.ApplicationInsights throw an human readable ConfigurationException or ArgumentException. e.g "The Application Insights configuration string was not set."

Relevant package, tooling and runtime versions

  • NET 6
  • ASP.NET Core Web app and Console app
  • Serilog.AspNetCore 6.0.1
  • Serilog.Extensions.Hosting 5.0.1
  • Serilog.Extensions.Logging 3.1.0
  • Serilog.Settings.Configuration 3.3.0
  • Serilog.Sinks.ApplicationInsights 4.0.0
  • Serilog.Sinks.Console 4.1.0

Additional context
Add any other context about the problem here.

@TinoMSoft TinoMSoft added the bug label Sep 7, 2022
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