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

Add C# 12 and .NET 8 polyfills #81

Merged
merged 12 commits into from
Nov 22, 2023
Merged

Add C# 12 and .NET 8 polyfills #81

merged 12 commits into from
Nov 22, 2023

Conversation

Sergio0694
Copy link
Owner

@Sergio0694 Sergio0694 commented Aug 20, 2023

Description

This PR adds the following polyfills for C# 12 and .NET 8:

  • [RequiresLocation]
  • [CollectionBuilder]
  • [UnsafeAccessor]
  • [Experimental]
  • [InlineArray]

@Sergio0694 Sergio0694 added the infrastructure Build/packaging related changes label Aug 20, 2023
@Sergio0694 Sergio0694 changed the title Remove .NET Core 3.1 TFMs Add C# 12 and .NET 8 polyfills Aug 20, 2023
@Sergio0694 Sergio0694 added enhancement New feature or request and removed infrastructure Build/packaging related changes labels Aug 20, 2023
@Sergio0694 Sergio0694 marked this pull request as draft August 20, 2023 18:18
@dongle-the-gadget
Copy link
Contributor

I thought UnsafeAccessor is not allowed within non .NET 8 binaries?

@WeihanLi
Copy link

.NET 8 had released, so is there a plan get this merged?

@Sergio0694
Copy link
Owner Author

Of course there is a plan, or this PR wouldn't exist. Just a little bit of patience, this is not my full time job 😅

README.md Outdated Show resolved Hide resolved
@Sergio0694
Copy link
Owner Author

Note: waiting on actions/runner-images#8797.

@Trinitek
Copy link

Note: waiting on actions/runner-images#8797.

The image seems to be updated now.

@Sergio0694 Sergio0694 marked this pull request as ready for review November 22, 2023 20:01
@Sergio0694 Sergio0694 merged commit 2a6e35e into main Nov 22, 2023
9 checks passed
@Sergio0694 Sergio0694 deleted the dev/net8-polyfills branch November 22, 2023 21:15
@sliekens
Copy link
Contributor

sliekens commented Dec 4, 2023

Hi @Sergio0694, is the namespace System.Runtime.CompilerServices2 a typo or was it intended for the InlineArrayAttribute?

@Sergio0694
Copy link
Owner Author

It's intended. Roslyn matches the attribute by full name, and will not let you use it if it's in the correct one and the runtime does not support it. So the only way to make that compile is to put it into a different namespace. I'm doing the same for [UnmanagedCallersOnly].

@sliekens
Copy link
Contributor

sliekens commented Dec 5, 2023

@Sergio0694 do you have any insight why InlineArrayAttribute shows up in my assembly's exported types but the other attributes don't? It's causing some neck pains with other tools which don't like it when I put types in the System namespace, e.g. dotnet/docfx#9507

@sliekens
Copy link
Contributor

sliekens commented Dec 5, 2023

Okay I see it's because InlineArrayAttribute visibility is always public, ignoring PolySharpUsePublicAccessibilityForGeneratedTypes. Is that a bug @Sergio0694 ?

@Sergio0694
Copy link
Owner Author

It is, yeah. I'll go fix it when I have a minute, good find! 😅

@sliekens
Copy link
Contributor

sliekens commented Dec 5, 2023

If it's just a matter of changing the visibility and bumping the version, I can make a PR.

@Sergio0694
Copy link
Owner Author

Just needs changing the visibility, the version is set automatically by the CI when I create a release branch 🙂

@sliekens
Copy link
Contributor

sliekens commented Dec 5, 2023

Voila #92

@AvremelM
Copy link

AvremelM commented Dec 5, 2023

Sorry for the comment spam, but it's insane to me that C# 12 has been out for less than a month and you've already released polyfill support for it.

Thank you so much @Sergio0694 (and collaborators!) for this project.

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

Successfully merging this pull request may close these issues.

6 participants