-
Notifications
You must be signed in to change notification settings - Fork 520
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
[BGen] Simplify BindAs for smart enums. #22222
base: main
Are you sure you want to change the base?
Conversation
This changes does two things: 1. Adds a GetValue internal helper for non value backend smart enums. 2. Uses the GetValue functions as the builder for the NSArray. The new method (1) is only added to those smart enums that use a none value type backing field that looks like the following: ```csharp internal static ASAuthorizationProviderAuthorizationOperation GetValue (NativeHandle handle) { using var str = Runtime.GetNSObject<NSString> (handle); return GetValue (str); } ``` This is later used to retrieve the enum values from the handle in a BindAs decorated method/property. This is very similar to what we did in #22216 and has the same performance considerations (there is no performance change after C# 11 and later).
|
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…rin/xamarin-macios into dev/mandel/smart-enum-from-nsstring
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [PR Build #2272a97] Build passed (Build packages) ✅Pipeline on Agent |
✅ [PR Build #2272a97] Build passed (Detect API changes) ✅Pipeline on Agent |
✅ [PR Build #2272a97] Build passed (Build macOS tests) ✅Pipeline on Agent |
🔥 Failed to compare API and create generator diff 🔥 Error: 'make' failed for the hash 30cce24. Pipeline on Agent |
💻 [PR Build #2272a97] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
💻 [PR Build #2272a97] Tests on macOS M1 - Mac Ventura (13) passed 💻✅ All tests on macOS M1 - Mac Ventura (13) passed. Pipeline on Agent |
💻 [PR Build #2272a97] Tests on macOS X64 - Mac Sonoma (14) passed 💻✅ All tests on macOS X64 - Mac Sonoma (14) passed. Pipeline on Agent |
💻 [PR Build #2272a97] Tests on macOS arm64 - Mac Sequoia (15) passed 💻✅ All tests on macOS arm64 - Mac Sequoia (15) passed. Pipeline on Agent |
🚀 [CI Build #2272a97] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 112 tests passed 🎉 Tests counts✅ cecil: All 1 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
This changes does two things:
The new method (1) is only added to those smart enums that use a none value type backing field that looks like the following:
This is later used to retrieve the enum values from the handle in a BindAs decorated method/property. This is very similar to what we did in #22216 and has the same performance considerations (there is no performance change after C# 11 and later).