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

Updating GenAPI to properly handle nint for C# 9 and later #9421

Merged
merged 1 commit into from
Jun 3, 2022

Conversation

tannergooding
Copy link
Member

{
if (TypeHelper.TypesAreEquivalent(type, type.PlatformType.SystemIntPtr))
{
if ((LangVersion >= LangVersion11_0) || type.Attributes.HasNativeIntegerAttribute())
Copy link
Member Author

Choose a reason for hiding this comment

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

Prior to C# 11, IntPtr was IntPtr and nint was [NativeInteger] IntPtr.

C# 11 and later, its just nint provided at least .NET 7 is targeted. Since C# 11 is only "officially" supported on .NET 7 and later, GenAPI can just treat this "synonymously".

@tannergooding
Copy link
Member Author

dotnet/runtime#69627 is the runtime side change that picks up the compiler changes

@ViktorHofer ViktorHofer requested a review from ericstj May 23, 2022 15:53
@ViktorHofer
Copy link
Member

I kindly ask @ericstj to review this change, as it touches the CCI codebase.

@ericstj ericstj requested a review from a team May 24, 2022 17:07
@ericstj
Copy link
Member

ericstj commented May 24, 2022

I'd like someone from @dotnet/area-infrastructure-libraries review the code for correctness and provide signoff.

Consider testing methods like those previously suggested in #8769 (comment) and share the details for how you tested this to ensure the changes work as expected without regressions.

@tannergooding
Copy link
Member Author

@ericstj, I validated this against dotnet/runtime as always.

The change is simply that on .NET 7 and later nint should always be used (IntPtr and nint are aliases of each other and we prefer keywords over fully qualified type names). Prior to .NET 7 its used if the relevant attribute is present.

@tannergooding
Copy link
Member Author

Ping @dotnet/area-infrastructure-libraries could this get a review and merge?

@tannergooding
Copy link
Member Author

@ViktorHofer could I get a sign-off on this one as well?

@ViktorHofer
Copy link
Member

ViktorHofer commented Jun 1, 2022

I asked @carlossanlop to take a look here as he recently touched the cci code base as well. I myself never worked on that library so I would like to defer to Carlos.

@ViktorHofer
Copy link
Member

Based on @tannergooding's comment, the reference sources in dotnet/runtime are already generated based on these changes so we should get this in asap. Merging.

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.

3 participants