Port CustomMarshalers.dll to C# and .NET Core (dotnet/coreclr#21343)
authorJeremy Koritzinsky <jkoritzinsky@gmail.com>
Thu, 6 Dec 2018 17:56:21 +0000 (09:56 -0800)
committerGitHub <noreply@github.com>
Thu, 6 Dec 2018 17:56:21 +0000 (09:56 -0800)
commit3339aec4c9fdfc85920065d44a0541a36345e1fc
tree5820e722569481bbebfe8b9dd614b8df120399bf
parentbbc56ce31ec2ad5114fa9eef4013d5b5310667e7
Port CustomMarshalers.dll to C# and .NET Core (dotnet/coreclr#21343)

* Import CustomMarshalers from corefx PR.

* Add tests for marshalling IEnumerator and IEnumerable using the System.Runtime.InteropServices.CustomMarshalers.

* Verify that the marshaller is used in the managed -> native direction in the tests.

* Remove #if's

* PR Feedback.

* Move ComHelpers.h into interop common headers.

* Add some template machinery to ensure that we don't accidentally pass in an incorrect type into DoQueryInterface.

* Add VariantClear

* Make marshalers internal and root them in ILLinkTrim.xml

* Revert enable-if machinery.

* Add tests for the pass-through unwrapping done by the EnumeratorToEnumVariantMarshaler.

* Remove some of my helper code.

* Added todo about exposing EnumerableToDispatchMarshaler.

* PR Feedback.

* Removed the last placement new.

* Use the runtime hooks to enable us to not have to publically expose the custom marshalers.

* Remove out of date comments.

Commit migrated from https://github.com/dotnet/coreclr/commit/5955967d808d1d88ef927235276d3ca82b5d9363
27 files changed:
src/coreclr/src/System.Private.CoreLib/ILLinkTrim.xml
src/coreclr/src/System.Private.CoreLib/Resources/Strings.resx
src/coreclr/src/System.Private.CoreLib/System.Private.CoreLib.csproj
src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComEventsSink.cs
src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IEnumerable.cs [new file with mode: 0644]
src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/CustomMarshalers/ComDataHelpers.cs [new file with mode: 0644]
src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/CustomMarshalers/EnumVariantViewOfEnumerator.cs [new file with mode: 0644]
src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/CustomMarshalers/EnumerableToDispatchMarshaler.cs [new file with mode: 0644]
src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/CustomMarshalers/EnumerableViewOfDispatch.cs [new file with mode: 0644]
src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/CustomMarshalers/EnumeratorToEnumVariantMarshaler.cs [new file with mode: 0644]
src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/CustomMarshalers/EnumeratorViewOfEnumVariant.cs [new file with mode: 0644]
src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/IDispatch.cs [new file with mode: 0644]
src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/NativeMethods.cs [deleted file]
src/coreclr/src/vm/classnames.h
src/coreclr/src/vm/mlinfo.cpp
src/coreclr/src/vm/mngstdinterfaces.cpp
src/coreclr/src/vm/mngstditflist.h
src/coreclr/tests/src/Interop/CMakeLists.txt
src/coreclr/tests/src/Interop/COM/NativeServer/Servers.h
src/coreclr/tests/src/Interop/PInvoke/IEnumerator/CMakeLists.txt [new file with mode: 0644]
src/coreclr/tests/src/Interop/PInvoke/IEnumerator/IEnumeratorNative.cpp [new file with mode: 0644]
src/coreclr/tests/src/Interop/PInvoke/IEnumerator/IEnumeratorNative.h [new file with mode: 0644]
src/coreclr/tests/src/Interop/PInvoke/IEnumerator/IEnumeratorTest.cs [new file with mode: 0644]
src/coreclr/tests/src/Interop/PInvoke/IEnumerator/IEnumeratorTest.csproj [new file with mode: 0644]
src/coreclr/tests/src/Interop/common/ComHelpers.h [moved from src/coreclr/tests/src/Interop/COM/NativeServer/ComHelpers.h with 100% similarity]
src/libraries/System.Private.CoreLib/src/System/Collections/IEnumerable.cs
src/libraries/System.Private.CoreLib/src/System/HResults.cs