Shutdown: Unsubscribe from AppDomain event handlers#256
Merged
FreeAndNil merged 4 commits intoapache:masterfrom Jun 16, 2025
Merged
Shutdown: Unsubscribe from AppDomain event handlers#256FreeAndNil merged 4 commits intoapache:masterfrom
FreeAndNil merged 4 commits intoapache:masterfrom
Conversation
When log4net is used in an AssemblyLoadContext that should be unloaded, log4net blocks the unloading since it subscribed to event handlers from the default load context. This PR aims to cleanup the 2 subscriptions that most likely cause this behaviour. Note that I did not fully test the solution yet. But this cleanup is a good measure in any case.
Contributor
|
Thanks for your contribution. |
jkotas
reviewed
Jun 14, 2025
| /// </remarks> | ||
| public static void Shutdown() | ||
| { | ||
| //Cleanup event handlers since they only call this mathod anyways |
There was a problem hiding this comment.
Suggested change
| //Cleanup event handlers since they only call this mathod anyways | |
| // Cleanup event handlers since they only call this method anyways |
FreeAndNil
approved these changes
Jun 16, 2025
Contributor
FreeAndNil
left a comment
There was a problem hiding this comment.
Thanks a lot.
I will fix the typo myself.
FreeAndNil
added a commit
that referenced
this pull request
Jun 16, 2025
Contributor
Author
|
Thanks, great to hear. Is there a CI build or the like that I could use for further testing this out? |
Contributor
|
Hi, I'm waiting for the completion of #257. |
Contributor
Author
|
@FreeAndNil Alright, no thats fine I will wait for preview ;) |
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.
When log4net is used in an AssemblyLoadContext that should be unloaded, log4net blocks the unloading since it subscribed to event handlers from the default load context. This PR aims to cleanup the 2 subscriptions that most likely cause this behaviour.
Related discussion here: dotnet/runtime#116142 also contains a working demo of the problem.
Note that I did not fully test the solution yet. But this cleanup is a good measure in any case.