-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Port CustomMarshalers.dll to C# and .NET Core #21343
Conversation
...CoreLib/src/System/Runtime/InteropServices/CustomMarshalers/EnumerableToDispatchMarshaler.cs
Outdated
Show resolved
Hide resolved
...eLib/src/System/Runtime/InteropServices/CustomMarshalers/EnumeratorToEnumVariantMarshaler.cs
Outdated
Show resolved
Hide resolved
src/System.Private.CoreLib/src/System/Runtime/InteropServices/IDispatch.cs
Outdated
Show resolved
Hide resolved
...e.CoreLib/src/System/Runtime/InteropServices/CustomMarshalers/EnumVariantViewOfEnumerator.cs
Outdated
Show resolved
Hide resolved
...e.CoreLib/src/System/Runtime/InteropServices/CustomMarshalers/EnumeratorViewOfEnumVariant.cs
Outdated
Show resolved
Hide resolved
| int hr = _enumVariantObject.Reset(); | ||
| if (hr < 0) | ||
| { | ||
| Marshal.ThrowExceptionForHR(hr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a case where the interop definition of the interface doesn't expose the HRESULT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an implementation of the IEnumerator.Reset method. The IEnumVARIANT interface exposes the HRESULT, so I was planning on throwing the exception in managed code.
…m.Runtime.InteropServices.CustomMarshalers.
… in an incorrect type into DoQueryInterface.
bbf33ab to
1094542
Compare
|
There are a bunch of duplicate issues that I have already commented on. I am not going to comment on each instance. Please be proactive and consider all my style comments and usage issues across the entire change. |
|
Sorry about that. I'm trying to fix them all but am not being as thorough as I should be. I'll be sure to be more careful. |
|
@dotnet-bot test Windows_NT x64 full_opt ryujit CoreCLR Perf Tests Correctness |
jkotas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My concerns are addressed. @AaronRobinsonMSFT Could you please sign-off as well?
AaronRobinsonMSFT
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
| { | ||
| // In desktop CLR we'll attempt to call through IDispatch(DISPID_NEWENUM) | ||
| // This is not supported in CoreCLR | ||
| COMPlusThrow(kPlatformNotSupportedException, IDS_EE_ERROR_IDISPATCH); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure to remove IDS_EE_ERROR_IDISPATCH if it isn't used anywhere else.
* 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. Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
* 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. Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
* 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. Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
* 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. Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
* 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. Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
|
Is this going to make it into .net core 2.x? |
|
The change is part of larger set of changes for full COM support in .NET Core. We do not plan to port the full COM support back to 2.x. |
* 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 dotnet/coreclr@5955967
Port the CustomMarshalers.dll from .NET Framework to .NET Core and put the code in System.Private.CoreLib.
Adds the System.Runtime.InteropServices.CustomMarshalers namespace with the types that are relevant/implementable on .NET Core.
Also adds relevant (Windows-only) tests.
Supercedes dotnet/corefx#33773