Custom Marshalers in custom-ALC-loaded assemblies results in types loaded from crossi...
authorJeremy Koritzinsky <jkoritzinsky@gmail.com>
Mon, 14 Jan 2019 23:49:45 +0000 (15:49 -0800)
committerGitHub <noreply@github.com>
Mon, 14 Jan 2019 23:49:45 +0000 (15:49 -0800)
commitb4650943618bfd06296c61f8f46bddce9b851015
tree6fe6f6d5617f0c19fabf8f2f7f3d158af02f6342
parente62ee275e4c1b35d217e2f760627751cbd4b2a11
Custom Marshalers in custom-ALC-loaded assemblies results in types loaded from crossing ALCs (#21606)

* Create repro for dotnet/coreclr#19654

* Update ICustomMarshaler.csproj

* Update ICustomMarshaler.csproj

* Clean up repro per feedback.

* Add test case for different assemblies with the same CustomMarshaler name.

* Move EEMarshalingData cache from AppDomain to LoaderAllocator. This fixes the custom-marshaler conflict when using unloadable assembly contexts.

* Internalize the LoaderHeap* parameter.

* Add the pointer to the requesting assembly to the hashtable key.

* Fix linux-musl build break.

* Move Crst out of FEATURE_COMINTEROP block.

* Make sure to copy over the assembly pointer to the key that's actually stored in the hash table.

* Add comment for m_invokingAssembly.

* Move all usages of EEMarshallingData to hang off the correct loader allocator instead of always the global one.

* Change to m_InteropDataCrst since this EEMarshallingData can be used in preemptive GC mode.

* Always init m_InteropDataCrst (since it's used by EEMarshallingData as well as COM).

* PR Feedback.

* Remove extraneous inlines.
27 files changed:
src/vm/appdomain.cpp
src/vm/appdomain.hpp
src/vm/ceemain.cpp
src/vm/cominterfacemarshaler.cpp
src/vm/custommarshalerinfo.cpp
src/vm/custommarshalerinfo.h
src/vm/dispparammarshaler.cpp
src/vm/ilmarshalers.cpp
src/vm/ilmarshalers.h
src/vm/interopconverter.cpp
src/vm/interoputil.cpp
src/vm/loaderallocator.cpp
src/vm/loaderallocator.hpp
src/vm/mlinfo.cpp
src/vm/mlinfo.h
tests/src/Interop/CMakeLists.txt
tests/src/Interop/ICustomMarshaler/ConflictingNames/CMakeLists.txt [new file with mode: 0644]
tests/src/Interop/ICustomMarshaler/ConflictingNames/CustomMarshaler.cs [new file with mode: 0644]
tests/src/Interop/ICustomMarshaler/ConflictingNames/CustomMarshaler.csproj [new file with mode: 0644]
tests/src/Interop/ICustomMarshaler/ConflictingNames/CustomMarshaler2.csproj [new file with mode: 0644]
tests/src/Interop/ICustomMarshaler/ConflictingNames/CustomMarshalerNative.cpp [new file with mode: 0644]
tests/src/Interop/ICustomMarshaler/ConflictingNames/MultipleALCs.csproj [new file with mode: 0644]
tests/src/Interop/ICustomMarshaler/ConflictingNames/RunInALC.cs [new file with mode: 0644]
tests/src/Interop/ICustomMarshaler/ConflictingNames/SameNameDifferentAssembly.cs [new file with mode: 0644]
tests/src/Interop/ICustomMarshaler/ConflictingNames/SameNameDifferentAssembly.csproj [new file with mode: 0644]
tests/src/Interop/ICustomMarshaler/Primitives/ICustomMarshaler.cs [moved from tests/src/Interop/ICustomMarshaler/ICustomMarshaler.cs with 100% similarity]
tests/src/Interop/ICustomMarshaler/Primitives/ICustomMarshaler.csproj [moved from tests/src/Interop/ICustomMarshaler/ICustomMarshaler.csproj with 92% similarity]