-
Notifications
You must be signed in to change notification settings - Fork 10
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
Improve support for Assemblies loaded into Collectible AssemblyLoadContexts #73
Comments
Hey, thanks for reporting this! Yeah, that shared type cache is a pretty old concept and it looks like this is the time for a rethink. Also, you are right about the registration tree is not cleared properly on disposing of the container, I'm going to refactor these in the next version. |
Hey, sorry for the late reaction! |
Hi - again sorry for looking into this late. I'm having trouble consuming the more recent version since I've got some functionality that relied on IResolutionScope.GetScopedInstanceOrDefault() (and also some functionality that leant on the extensions APIs to control disposal order, but I believe that is more easily side-stepped). I'll have a look and see if behavior no longer requires the kind of approach I was taking, though, once I get me code to compile enough. |
Closing due to inactivity, feel free to reopen this, or create a new issue when something related comes up. |
As of .Net Core 3.0, it is possible to set custom
AssemblyLoadContext
s to be collectible, which should enable associatedTypes
to be unloaded when theUnload
method is called on that context.There are two behaviours Stashbox currently has that mean that calling
Unload
is ineffective when the types from such anAssemblyLoadContext
have been loaded into aStashboxContainer
or aResolutionScope
:Stashbox.Entity.MetaInformation.MetaRepository
that retains (I think) all types that Stashbox has encountered.For my immediate use case, the below method addresses the issue by nulling all fields within the container, and re-initializing the
MetaRepository
to the value used in the Stashbox source. However, it would be great if something similar could take place when simply disposing of theStashboxContainer
. Obviously becauseMetaRespository
is shared, I'm also not completely certain that invalidating it in this manner is safe.The text was updated successfully, but these errors were encountered: