Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify the rules on UnmanagedCallersOnly #3823

Merged
merged 4 commits into from
Aug 26, 2020

Conversation

333fred
Copy link
Member

@333fred 333fred commented Aug 25, 2020

No description provided.

@333fred
Copy link
Member Author

333fred commented Aug 25, 2020

@elinor-fung @jkotas @jaredpar @AaronRobinsonMSFT for review. I've updated the rules for UnmanagedCallersOnly following discussion on the implementation of dotnet/roslyn#47008.

@333fred
Copy link
Member Author

333fred commented Aug 25, 2020

@jkotas addressed feedback. Vector128<int> and int? will both be allowed by the C# spec now.

1. Simplify the parameter/return requirements.
2. Clarify the intent around invalid imported metadata.
@AaronRobinsonMSFT
Copy link
Member

Lgtm

@333fred 333fred merged commit 31289a8 into dotnet:master Aug 26, 2020
@333fred 333fred deleted the update-unmanagedcallesonly branch August 26, 2020 17:18
* It is an error to apply the attribute to anything other than a static method. The C# compiler will mark any non-static
methods imported from metadata with this attribute as unsupported by the language.
* It is an error to have managed types as parameters or the return type of a method marked with the attribute.
* It is an error to apply the attribute to anything other than an ordinary static method or ordinary static local function.
Copy link
Member

Choose a reason for hiding this comment

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

Just wondering, but why are operators/properties restricted here? Is it just a language limitation, similar to binding against a signature that takes explicit this for instance methods?

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct, this is a language limitation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants