Make it statically and dynamicaly discoverable if runtime supports assembly unloading #20980
Labels
api-needs-work
API needs work before it is approved, it is NOT ready for implementation
area-System.Runtime
Milestone
Just thought of a runtime capability, that would be convenient to check for - ability to unload types/assemblies.
I have seen many examples where code goes to great lengths trying to not retain runtime type objects - do not put types as keys (unless the type is a known primitive) in Dictionaries/Caches, do not cache delegates .... - That is with the assumption that retaining type objects will prevent assembly unloading.
However, if I am not mistaken, only a few, if any, runtimes can actually unload types/assemblies.
It would be helpful for the dynamic scenarios, to know if unloading is not possible and thus no need to worry about, for example, using type objects as keys in caches.
Proposed API
(part of overall capability probing framework as in https://github.com/dotnet/corefx/issues/17116)
Any better name is more than welcome.
Any already existing conventional way to probe for the above would be fine too.
The text was updated successfully, but these errors were encountered: