Skip to content
New issue

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

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

Already on GitHub? # to your account

[BGen] Simplify BindAs for smart enums. #22222

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

mandel-macaque
Copy link
Member

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:

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).

mandel-macaque and others added 2 commits February 20, 2025 17:40
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).
Copy link
Contributor

⚠️ Your code has been reformatted. ⚠️

If this is not desired, add the actions-disable-autoformat label, and revert the reformatting commit.

If files unrelated to your change were modified, try reverting the reformatting commit + merging with the target branch (and push those changes).

@rolfbjarne
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@vs-mobiletools-engineering-service2
Copy link
Collaborator

❌ [CI Build #f58e68d] Tests on macOS M1 - Mac Monterey (12) failed ❌

Tests on macOS M1 - Mac Monterey (12) failed for unknown reasons.

Pipeline on Agent
Hash: f58e68da22f55e9750963a55c81ef2b3d728174e [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

❌ [CI Build #f58e68d] Tests on macOS M1 - Mac Ventura (13) failed ❌

Tests on macOS M1 - Mac Ventura (13) failed for unknown reasons.

Pipeline on Agent
Hash: f58e68da22f55e9750963a55c81ef2b3d728174e [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

❌ [CI Build #f58e68d] Tests on macOS arm64 - Mac Sequoia (15) failed ❌

Tests on macOS arm64 - Mac Sequoia (15) failed for unknown reasons.

Pipeline on Agent
Hash: f58e68da22f55e9750963a55c81ef2b3d728174e [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

❌ [CI Build #f58e68d] Tests on macOS X64 - Mac Sonoma (14) failed ❌

Tests on macOS X64 - Mac Sonoma (14) failed for unknown reasons.

Pipeline on Agent
Hash: f58e68da22f55e9750963a55c81ef2b3d728174e [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🔥 [PR Build #605ab68] Build failed (Build macOS tests) 🔥

Build failed for the job 'Build macOS tests' (with job status 'Failed')

Pipeline on Agent
Hash: 605ab68c65225fd6fc56213207362f389d91bf8b [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🔥 Failed to compare API and create generator diff 🔥

Error: 'make' failed for the hash 30cce24.

Pipeline on Agent
Hash: 605ab68c65225fd6fc56213207362f389d91bf8b [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🔥 [CI Build #605ab68] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

0 tests crashed, 73 tests failed, 39 tests passed.

Failures

❌ dotnettests tests (iOS)

1 tests failed, 0 tests passed.
  • DotNet tests: Failed (Execution failed with exit code 1)

Html Report (VSDrops) Download

❌ dotnettests tests (MacCatalyst)

1 tests failed, 0 tests passed.
  • DotNet tests: Failed (Execution failed with exit code 1)

Html Report (VSDrops) Download

❌ dotnettests tests (macOS)

1 tests failed, 0 tests passed.
  • DotNet tests: Failed (Execution failed with exit code 1)

Html Report (VSDrops) Download

❌ dotnettests tests (tvOS)

1 tests failed, 0 tests passed.
  • DotNet tests: Failed (Execution failed with exit code 1)

Html Report (VSDrops) Download

❌ generator tests

1 tests failed, 4 tests passed.
  • BGen tests: Failed (Execution failed with exit code 1)

Html Report (VSDrops) Download

❌ interdependent-binding-projects tests

4 tests failed, 0 tests passed.
  • interdependent-binding-projects/macOS/Debug: BuildFailure
  • interdependent-binding-projects/Mac Catalyst/Debug: BuildFailure
  • interdependent-binding-projects/iOS - simulator/Debug: BuildFailure
  • interdependent-binding-projects/tvOS - simulator/Debug: BuildFailure

Html Report (VSDrops) Download

❌ linker tests

28 tests failed, 16 tests passed.
  • link sdk/macOS/Debug: BuildFailure
  • link sdk/macOS/Release: BuildFailure
  • link sdk/Mac Catalyst/Debug: BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • link sdk/Mac Catalyst/Release: BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • link sdk/iOS - simulator/Debug: BuildFailure
  • link sdk/iOS - simulator/Release: BuildFailure
  • link sdk/tvOS - simulator/Debug: BuildFailure
  • link sdk/tvOS - simulator/Release: BuildFailure
  • link all/macOS/Debug: BuildFailure
  • link all/macOS/Debug (bundle original resources): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • link all/macOS/Release: BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • link all/Mac Catalyst/Debug: BuildFailure
  • link all/Mac Catalyst/Debug (bundle original resources): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • link all/Mac Catalyst/Release: BuildFailure
  • link all/iOS - simulator/Debug: BuildFailure
  • link all/iOS - simulator/Release: BuildFailure
  • link all/iOS - simulator/Debug (bundle original resources): BuildFailure
  • link all/tvOS - simulator/Debug: BuildFailure
  • link all/tvOS - simulator/Release: BuildFailure
  • link all/tvOS - simulator/Debug (bundle original resources): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • trimmode link/macOS/Debug: BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • trimmode link/macOS/Release: BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • trimmode link/Mac Catalyst/Debug: BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • trimmode link/Mac Catalyst/Release: BuildFailure
  • trimmode link/iOS - simulator/Debug: BuildFailure
  • trimmode link/iOS - simulator/Release: BuildFailure
  • trimmode link/tvOS - simulator/Debug: BuildFailure
  • trimmode link/tvOS - simulator/Release: BuildFailure

Html Report (VSDrops) Download

❌ monotouch tests (iOS)

8 tests failed, 0 tests passed.
  • monotouch-test/iOS - simulator/Debug: BuildFailure
  • monotouch-test/iOS - simulator/Debug (LinkSdk): BuildFailure
  • monotouch-test/iOS - simulator/Debug (static registrar): BuildFailure
  • monotouch-test/iOS - simulator/Release (all optimizations): BuildFailure
  • monotouch-test/iOS - simulator/Debug (managed static registrar): BuildFailure
  • monotouch-test/iOS - simulator/Release (managed static registrar, all optimizations): BuildFailure
  • monotouch-test/iOS - simulator/Release (NativeAOT, x64): BuildFailure
  • monotouch-test/iOS - simulator/Debug (interpreter): BuildFailure

Html Report (VSDrops) Download

❌ monotouch tests (MacCatalyst)

11 tests failed, 0 tests passed.
  • monotouch-test/Mac Catalyst/Debug: BuildFailure
  • monotouch-test/Mac Catalyst/Debug (managed static registrar): BuildFailure
  • monotouch-test/Mac Catalyst/Debug (static registrar): BuildFailure
  • monotouch-test/Mac Catalyst/Release (managed static registrar): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • monotouch-test/Mac Catalyst/Release (managed static registrar, all optimizations): BuildFailure
  • monotouch-test/Mac Catalyst/Release (NativeAOT): BuildFailure
  • monotouch-test/Mac Catalyst/Release (NativeAOT, x64): BuildFailure
  • monotouch-test/Mac Catalyst/Release (static registrar): BuildFailure
  • monotouch-test/Mac Catalyst/Release (static registrar, all optimizations): BuildFailure
  • monotouch-test/Mac Catalyst/Debug (interpreter): BuildFailure
  • monotouch-test/Mac Catalyst/Release (interpreter): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))

Html Report (VSDrops) Download

❌ monotouch tests (macOS)

9 tests failed, 0 tests passed.
  • monotouch-test/macOS/Debug: BuildFailure
  • monotouch-test/macOS/Debug (managed static registrar): BuildFailure
  • monotouch-test/macOS/Debug (static registrar): BuildFailure
  • monotouch-test/macOS/Release (managed static registrar): BuildFailure
  • monotouch-test/macOS/Release (managed static registrar, all optimizations): BuildFailure
  • monotouch-test/macOS/Release (NativeAOT): BuildFailure
  • monotouch-test/macOS/Release (NativeAOT, x64): BuildFailure
  • monotouch-test/macOS/Release (static registrar): BuildFailure
  • monotouch-test/macOS/Release (static registrar, all optimizations): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))

Html Report (VSDrops) Download

❌ monotouch tests (tvOS)

8 tests failed, 0 tests passed.
  • monotouch-test/tvOS - simulator/Debug: BuildFailure
  • monotouch-test/tvOS - simulator/Debug (LinkSdk): BuildFailure
  • monotouch-test/tvOS - simulator/Debug (static registrar): BuildFailure
  • monotouch-test/tvOS - simulator/Release (all optimizations): BuildFailure
  • monotouch-test/tvOS - simulator/Debug (managed static registrar): BuildFailure
  • monotouch-test/tvOS - simulator/Release (managed static registrar, all optimizations): BuildFailure
  • monotouch-test/tvOS - simulator/Release (NativeAOT, x64): BuildFailure
  • monotouch-test/tvOS - simulator/Debug (interpreter): BuildFailure

Html Report (VSDrops) Download

Successes

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: 605ab68c65225fd6fc56213207362f389d91bf8b [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [PR Build #2272a97] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 2272a974d4604b0f32e5fe40748ef285370534b6 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [PR Build #2272a97] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 2272a974d4604b0f32e5fe40748ef285370534b6 [PR build]

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

Successfully merging this pull request may close these issues.

4 participants