ApplicationInsights-dotnet icon indicating copy to clipboard operation
ApplicationInsights-dotnet copied to clipboard

TelemetryConfiguration is not disposed

Open davidmatson opened this issue 6 years ago • 7 comments

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.

davidmatson avatar Jul 19 '19 19:07 davidmatson

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

davidmatson avatar Jul 19 '19 19:07 davidmatson

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.

github-actions[bot] avatar Sep 18 '21 00:09 github-actions[bot]

/remove-stale

davidmatson avatar Sep 18 '21 00:09 davidmatson

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.

github-actions[bot] avatar Jul 16 '22 00:07 github-actions[bot]

/remove-stale

davidmatson avatar Jul 16 '22 02:07 davidmatson

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.

github-actions[bot] avatar May 13 '23 00:05 github-actions[bot]

/remove-stale

davidmatson avatar May 13 '23 01:05 davidmatson