Enable unloading of AssemblyLoadContext (dotnet/coreclr#18476)
authorJan Vorlicek <janvorli@microsoft.com>
Thu, 23 Aug 2018 00:42:43 +0000 (02:42 +0200)
committerGitHub <noreply@github.com>
Thu, 23 Aug 2018 00:42:43 +0000 (02:42 +0200)
commit20feb1204bfae7ccaf1e66e0ac8b499169bbf214
tree5c02b19b548b8b9773a639257638b4c0fdd87efa
parente17698ceeaf03e560d0b41f2aeb57261393e2654
Enable unloading of AssemblyLoadContext (dotnet/coreclr#18476)

Enable assembly unloading

* Allow PInvoke methods on collectible assemblies

* Fix test unloadability

Several hundreds of tests were using Helper class that created
GCHandle, but never freed it. That prevented unloading of those
tests. The change modifies the Helper class to keep the handle
in a finalizable object.

Several GCHandle related tests were not freeing the GCHandle they
allocated, so this change adds freeing them to enable the unloading.

* Add missing error messages to the resources

* Fix shuffle thunk cache for unloadability

* Add GetLoaderAllocator to ICLRPrivBinder

Commit migrated from https://github.com/dotnet/coreclr/commit/8cd4b39a42c1c7cf37502357e6a4cb2888f5dfd7
59 files changed:
src/coreclr/clr.coreclr.props
src/coreclr/clr.defines.targets
src/coreclr/src/System.Private.CoreLib/Resources/Strings.resx
src/coreclr/src/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.cs
src/coreclr/src/binder/assembly.cpp
src/coreclr/src/binder/clrprivbinderassemblyloadcontext.cpp
src/coreclr/src/binder/clrprivbindercoreclr.cpp
src/coreclr/src/binder/inc/assembly.hpp
src/coreclr/src/binder/inc/clrprivbinderassemblyloadcontext.h
src/coreclr/src/binder/inc/clrprivbindercoreclr.h
src/coreclr/src/dlls/mscorrc/mscorrc.rc
src/coreclr/src/dlls/mscorrc/resource.h
src/coreclr/src/inc/clrprivbinderutil.h
src/coreclr/src/inc/clrprivbinding.idl
src/coreclr/src/inc/loaderheap.h
src/coreclr/src/pal/prebuilt/inc/clrprivbinding.h
src/coreclr/src/utilcode/loaderheap.cpp
src/coreclr/src/vm/appdomain.cpp
src/coreclr/src/vm/appdomain.hpp
src/coreclr/src/vm/arm/cgencpu.h
src/coreclr/src/vm/arm/stubs.cpp
src/coreclr/src/vm/assembly.cpp
src/coreclr/src/vm/assemblynative.cpp
src/coreclr/src/vm/assemblynative.hpp
src/coreclr/src/vm/assemblyspec.cpp
src/coreclr/src/vm/assemblyspec.hpp
src/coreclr/src/vm/ceeload.cpp
src/coreclr/src/vm/clrprivbinderloadfile.h
src/coreclr/src/vm/clrprivbinderwinrt.h
src/coreclr/src/vm/comdelegate.cpp
src/coreclr/src/vm/comdelegate.h
src/coreclr/src/vm/coreassemblyspec.cpp
src/coreclr/src/vm/domainfile.cpp
src/coreclr/src/vm/domainfile.h
src/coreclr/src/vm/dynamicmethod.cpp
src/coreclr/src/vm/ecalllist.h
src/coreclr/src/vm/eventtrace.cpp
src/coreclr/src/vm/excep.cpp
src/coreclr/src/vm/hash.h
src/coreclr/src/vm/i386/stublinkerx86.cpp
src/coreclr/src/vm/i386/stublinkerx86.h
src/coreclr/src/vm/jithelpers.cpp
src/coreclr/src/vm/jitinterface.cpp
src/coreclr/src/vm/loaderallocator.cpp
src/coreclr/src/vm/loaderallocator.hpp
src/coreclr/src/vm/loaderallocator.inl
src/coreclr/src/vm/methodtable.inl
src/coreclr/src/vm/methodtablebuilder.cpp
src/coreclr/src/vm/stublink.cpp
src/coreclr/src/vm/stublink.h
src/coreclr/tests/src/GC/API/GCHandle/Casting.cs
src/coreclr/tests/src/GC/API/GCHandle/Normal.cs
src/coreclr/tests/src/GC/API/GCHandle/Target.cs
src/coreclr/tests/src/GC/API/GCHandle/ToFromIntPtr.cs
src/coreclr/tests/src/GC/API/WeakReference/Finalize.cs
src/coreclr/tests/src/JIT/Directed/nullabletypes/Desktop/StructDefinitions.cs
src/coreclr/tests/src/JIT/Regression/CLR-x86-JIT/V1-M09/b13621/b13621.cs
src/coreclr/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/structdef.cs
src/coreclr/tests/src/JIT/jit64/valuetypes/nullable/castclass/structdef.cs