Port CustomMarshalers.dll to C# and .NET Core (#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)
commit5955967d808d1d88ef927235276d3ca82b5d9363
tree01eac29f273a440508969afecae331410aa6f63f
parent045f470f71cfcedf3eb7ff248f25bf29619d9a88
Port CustomMarshalers.dll to C# and .NET Core (#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.
27 files changed:
src/System.Private.CoreLib/ILLinkTrim.xml
src/System.Private.CoreLib/Resources/Strings.resx
src/System.Private.CoreLib/System.Private.CoreLib.csproj
src/System.Private.CoreLib/shared/System/Collections/IEnumerable.cs
src/System.Private.CoreLib/shared/System/HResults.cs
src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComEventsSink.cs
src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IEnumerable.cs [new file with mode: 0644]
src/System.Private.CoreLib/src/System/Runtime/InteropServices/CustomMarshalers/ComDataHelpers.cs [new file with mode: 0644]
src/System.Private.CoreLib/src/System/Runtime/InteropServices/CustomMarshalers/EnumVariantViewOfEnumerator.cs [new file with mode: 0644]
src/System.Private.CoreLib/src/System/Runtime/InteropServices/CustomMarshalers/EnumerableToDispatchMarshaler.cs [new file with mode: 0644]
src/System.Private.CoreLib/src/System/Runtime/InteropServices/CustomMarshalers/EnumerableViewOfDispatch.cs [new file with mode: 0644]
src/System.Private.CoreLib/src/System/Runtime/InteropServices/CustomMarshalers/EnumeratorToEnumVariantMarshaler.cs [new file with mode: 0644]
src/System.Private.CoreLib/src/System/Runtime/InteropServices/CustomMarshalers/EnumeratorViewOfEnumVariant.cs [new file with mode: 0644]
src/System.Private.CoreLib/src/System/Runtime/InteropServices/IDispatch.cs [new file with mode: 0644]
src/System.Private.CoreLib/src/System/Runtime/InteropServices/NativeMethods.cs [deleted file]
src/vm/classnames.h
src/vm/mlinfo.cpp
src/vm/mngstdinterfaces.cpp
src/vm/mngstditflist.h
tests/src/Interop/CMakeLists.txt
tests/src/Interop/COM/NativeServer/Servers.h
tests/src/Interop/PInvoke/IEnumerator/CMakeLists.txt [new file with mode: 0644]
tests/src/Interop/PInvoke/IEnumerator/IEnumeratorNative.cpp [new file with mode: 0644]
tests/src/Interop/PInvoke/IEnumerator/IEnumeratorNative.h [new file with mode: 0644]
tests/src/Interop/PInvoke/IEnumerator/IEnumeratorTest.cs [new file with mode: 0644]
tests/src/Interop/PInvoke/IEnumerator/IEnumeratorTest.csproj [new file with mode: 0644]
tests/src/Interop/common/ComHelpers.h [moved from tests/src/Interop/COM/NativeServer/ComHelpers.h with 100% similarity]