-
-
Notifications
You must be signed in to change notification settings - Fork 336
Shutdown: Unsubscribe from AppDomain event handlers #256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Thanks for your contribution. |
@@ -339,6 +339,10 @@ public static ILogger GetLogger(Assembly repositoryAssembly, Type type) | |||
/// </remarks> | |||
public static void Shutdown() | |||
{ | |||
//Cleanup event handlers since they only call this mathod anyways |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//Cleanup event handlers since they only call this mathod anyways | |
// Cleanup event handlers since they only call this method anyways |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot.
I will fix the typo myself.
Thanks, great to hear. Is there a CI build or the like that I could use for further testing this out? |
Hi, I'm waiting for the completion of #257. |
@FreeAndNil Alright, no thats fine I will wait for preview ;) |
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.