-
Notifications
You must be signed in to change notification settings - Fork 516
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
[release/6.0.3xx] [NET Attribute Conversion][generator] Generate NET style attributes #14877
[release/6.0.3xx] [NET Attribute Conversion][generator] Generate NET style attributes #14877
Conversation
- The integration with the existing generator code is not ideal in this commit, but given time pressures it will hopefully be improved in the future. - GetPlatformAttributesToPrint is repeating some of the logic that is #if !NET'ed out in places such as PrintPlatformAttributes because those checks were not robust enough for the NET6 attribute logic (we generate many more 'duplicate' attributes now)
…remove now unnecessary ignores on other tests
- This is an actual API inclusion, not just attribute change. - All of the other defines, and attributes imply that GetCurrentInputDevice() was expected to be on catalyst, but the define on 433 did not include it
Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
…re lower cased in one place but not another)
- Generate Obsolete/Advice and Unsupported pairs for Deprecated/Obsoleted instead of a single attribute - A number of generator improvements and test/binding fixes
…mespaceNotIncluded always assuming we're core
📋 [PR Build] API Diff 📋API Current PR diffℹ️ API Diff (from PR only) (please review changes) View dotnet API diffView dotnet legacy API diffAPI diff✅ API Diff from stable View dotnet API diffView dotnet legacy API diffGenerator diffℹ️ Generator Diff (please review changes) Pipeline on Agent XAMBOT-1030.Monterey' |
❌ [PR Build] Tests on macOS Mac Catalina (10.15) failed ❌Failed tests are:
Pipeline on Agent |
I just tested this against 4 NET ported sames TJ pointed out had warnings and the largest MAUI sample (https://github.com/microsoft/dotnet-podcasts) and there were no spurious availability warnings. This is good enough to go in. |
?? the final large piece of the saga that is #10170
We won't know until landing this and testing the result but it's the last known hole.....
Summary
This PR teaches our code generator to generate .NET 6 style availability attributes, adds a 4th Cecil test to verify our generated attributes, and a metric ton of API changes to satisfy that test.
Details
The generator work is the core of this PR, and includes:
FilterMinimumVersion
andPrintPlatformAttributes
Is64BitiOSOnly
.GetPlatformAttributesToPrint
, which synthesizes many attributes "out of thing air" from:PrintPlatformAttributesNoDuplicates
andGenerateProperty
because the existing PrintPlatformAttributes did not pass down parent context down, and the refactor was dangerous/too time consuming given time pressure.There are two intended API changes introduced by the reviews in this PR:
GetCurrentInputDevice
was obviously intended by availability attributes to exist on Catalyst but due to define confusion was excluded. It is an addition inMicrosoft.MacCatalyst.dll
only.NEAppRule
constructors were mis-marked on platforms, and were showing up incorrectly on Mac/Catalyst. I corrected the Catalyst one unconditionally, as we have not shipped Catalyst yet, but Mac is only fixed in NET6.Known API changes
Limitations
I could spend another week or two polishing this, at minimum. It is being landed in this state due to time pressure.
There are bugs in the generated attributes:
Each of these has cases hit that are Ignored in test code (see
IgnoreElementsThatDoNotExistInThatAssembly
).Other things to note (and forgive) include:
#if
hacks in generator.cs, which are signs that my hacked in code did not gel well with the existing logic. I should in theory extend each check to better handle the NET6 availability attribute reality and then remove logic from GetPlatformAttributesToPrint.Despite this, given time pressure and test coverage I think it is ready to go in.
I've filed #14802 to track the cleanup work from this PR.
Backport of #14779