ApplicationInsights-dotnet
ApplicationInsights-dotnet copied to clipboard
TelemetryConfiguration is not disposed
ILoggerProvider access TelemetryConfiguration through the service provider via IOptions rather than directly. As a result, the service provided does not have TelemetryConfiguration in its list of disposable items, and disposing the service provider does not dispose the telemetry configuration. (Assuming I'm reading all the code correctly.)
It appears that options are not intended to be disposable, so the ILoggerProvider implementation should likely depend on TelemetryConfiguration directly rather than through IOptions, and then it will get disposed by the service provider. Also, the builder extension methods would likely need to be updated to register a singleton for the TelemetryConfiguration class if a registration does not already exist.
It looks like the root cause is this change; formerly the logger provider did use the telemetry configuration directly: https://github.com/microsoft/ApplicationInsights-dotnet-logging/commit/f9728ec758b67042c27498d645e5ad0c1b1bf8c0
This issue is stale because it has been open 300 days with no activity. Remove stale label or comment or this will be closed in 7 days.
/remove-stale
This issue is stale because it has been open 300 days with no activity. Remove stale label or this will be closed in 7 days. Commenting will instruct the bot to automatically remove the label.
/remove-stale
This issue is stale because it has been open 300 days with no activity. Remove stale label or this will be closed in 7 days. Commenting will instruct the bot to automatically remove the label.
/remove-stale