Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Conversation

@jkoritzinsky
Copy link
Member

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

int hr = _enumVariantObject.Reset();
if (hr < 0)
{
Marshal.ThrowExceptionForHR(hr);
Copy link
Member

@AaronRobinsonMSFT AaronRobinsonMSFT Dec 4, 2018

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?

Copy link
Member Author

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.

@AaronRobinsonMSFT
Copy link
Member

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.

@jkoritzinsky
Copy link
Member Author

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.

@jkoritzinsky
Copy link
Member Author

@dotnet-bot test Windows_NT x64 full_opt ryujit CoreCLR Perf Tests Correctness
@dotnet-bot test Windows_NT x64 min_opt ryujit CoreCLR Perf Tests Correctness
@dotnet-bot test Windows_NT x86 full_opt ryujit CoreCLR Perf Tests Correctness
@dotnet-bot test Windows_NT x86 min_opt ryujit CoreCLR Perf Tests Correctness

Copy link
Member

@jkotas jkotas left a 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?

Copy link
Member

@AaronRobinsonMSFT AaronRobinsonMSFT left a 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);
Copy link
Member

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.

@jkoritzinsky jkoritzinsky merged commit 5955967 into dotnet:master Dec 6, 2018
@jkoritzinsky jkoritzinsky deleted the custom-marshalers branch December 6, 2018 17:56
Dotnet-GitSync-Bot pushed a commit to Dotnet-GitSync-Bot/corefx that referenced this pull request Dec 6, 2018
* 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>
Dotnet-GitSync-Bot pushed a commit to Dotnet-GitSync-Bot/corert that referenced this pull request Dec 6, 2018
* 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>
jkoritzinsky added a commit to dotnet/corert that referenced this pull request Dec 6, 2018
* 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>
stephentoub pushed a commit to dotnet/corefx that referenced this pull request Dec 6, 2018
* 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>
jlennox pushed a commit to jlennox/corefx that referenced this pull request Dec 16, 2018
* 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>
@jjxtra
Copy link

jjxtra commented Jan 28, 2019

Is this going to make it into .net core 2.x?

@jkotas
Copy link
Member

jkotas commented Jan 28, 2019

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.

picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
* 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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants