Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Housekeeping changes to tighten IDisposable ownership/cleanup in internal infrastructure and dev-mode components, aligning resource lifetimes with .NET disposal best practices.
Changes:
- Dispose
CancellationTokenSourceinDatabaseServerMessenger’s dispose path. - Dispose
JsonDocumentafter deserializing cache refresh instructions inCacheInstructionService. - Ensure cryptography primitives (
ICryptoTransform,CryptoStream) are disposed in legacy password decryption. - Make
InMemoryAssemblyLoadContextManagerdisposable to unsubscribe fromAssemblyLoadContext.Default.Resolving.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Umbraco.Infrastructure/Sync/DatabaseServerMessenger.cs | Disposes the internal CancellationTokenSource during managed disposal. |
| src/Umbraco.Infrastructure/Services/CacheInstructionService.cs | Adds disposal of JsonDocument after instruction extraction. |
| src/Umbraco.Infrastructure/Security/MemberPasswordHasher.cs | Scopes crypto resources with using to ensure deterministic cleanup. |
| src/Umbraco.Cms.DevelopmentMode.Backoffice/InMemoryAuto/InMemoryAssemblyLoadContextManager.cs | Implements IDisposable to unsubscribe the default ALC resolving handler. |
IDisposable resources correctly in four internal classes
IDisposable resources correctly in four internal classesIDisposable resources correctly in four internal classes
This was referenced Apr 2, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Housekeeping PR that ensures four internal
IDisposableresources are disposed correctly, in line with .NET best practices.None of these are suspected to cause real-world problems. The disposed objects are either short-lived, cleaned up at shutdown, or finalized by the GC eventually. However, they are violations of the
IDisposablecontract and worth fixing for code hygiene.Testing
Visual inspection will suffice here.