Skip to content

Follow the same failure behavior for [ComImport] classes on Windows with built-in COM disabled as non-Windows. - #54298

Merged
jkoritzinsky merged 2 commits into
dotnet:mainfrom
jkoritzinsky:comobject-nocom-fail
Jun 16, 2021
Merged

jkoritzinsky merged 2 commits into
dotnet:mainfrom
jkoritzinsky:comobject-nocom-fail

Conversation

@jkoritzinsky

Copy link
Copy Markdown
Member

On non-Windows, CoreCLR sets a flag on a class with [ComImport] so that we remember that it is a [ComImport] type and it allows the type to be loaded. Then, when the constructor is called, CoreCLR throws a PlatformNotSupportedException.

This PR enables the same behavior on Windows when the __ComObject type is not present (the disabled built-in COM scenario).

@jkoritzinsky jkoritzinsky added area-Interop-coreclr linkable-framework Issues associated with delivering a linker friendly framework labels Jun 16, 2021
@jkoritzinsky jkoritzinsky added this to the 6.0.0 milestone Jun 16, 2021
@ghost

ghost commented Jun 16, 2021

Copy link
Copy Markdown

Tagging subscribers to 'linkable-framework': @eerhardt, @vitek-karas, @LakshanF, @sbomer, @joperezr
See info in area-owners.md if you want to be subscribed.

Issue Details

On non-Windows, CoreCLR sets a flag on a class with [ComImport] so that we remember that it is a [ComImport] type and it allows the type to be loaded. Then, when the constructor is called, CoreCLR throws a PlatformNotSupportedException.

This PR enables the same behavior on Windows when the __ComObject type is not present (the disabled built-in COM scenario).

Author: jkoritzinsky
Assignees: -
Labels:

area-Interop-coreclr, linkable-framework

Milestone: 6.0.0

@LakshanF LakshanF left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this! The test part looks good to me and I'll defer to your peers for the product change CR.

@jkoritzinsky
jkoritzinsky merged commit e16be6d into dotnet:main Jun 16, 2021
@jkoritzinsky
jkoritzinsky deleted the comobject-nocom-fail branch June 16, 2021 22:05
@ghost ghost locked as resolved and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-Interop-coreclr linkable-framework Issues associated with delivering a linker friendly framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants