Transient disposable ManualHealthCheck<> against dependency injection guideline #4847
KalleOlaviNiemitalo
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
General
IDisposable
guidelines include:Contrary to this guideline, the CommonHealthChecksExtensions.AddManualHealthCheckDependencies method registers
ManualHealthCheck<>
with a transient lifetime, and it implements IDisposable. Its instances can therefore accumulate in the DI container if resolved from the root scope.extensions/src/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.Common/CommonHealthChecksExtensions.Manual.cs
Lines 55 to 59 in b31f7e9
extensions/src/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.Common/ManualHealthCheck.cs
Line 9 in b31f7e9
extensions/src/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.Common/IManualHealthCheck.cs
Line 23 in b31f7e9
extensions/src/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.Common/IManualHealthCheck.cs
Line 11 in b31f7e9
Beta Was this translation helpful? Give feedback.
All reactions