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] Add support for binding constructors in protocols. Fixes #14039. #20583
base: main
Are you sure you want to change the base?
Conversation
Add support for binding constructors in protocols. Given the api definition: ```cs [Protocol] public interface Protocol { [Abstract] [Export ("init")] IntPtr Constructor (); [Export ("initWithValue:")] IntPtr Constructor (IntPtr value); [BindAs ("Create")] [Export ("initWithPlanet:")] IntPtr Constructor (); } ``` we're binding it like this: ```cs [Protocol ("Protocol")] public interface IProtocol : INativeObject { [Export ("init")] public static T CreateInstance<T> () where T: NSObject, IProtocol { /* default implementation */ } [Export ("initWithValue:")] public static T CreateInstance<T> () where T: NSObject, IProtocol { /* default implementation */ } [Export ("initWithPlanet:")] public static T Create<T> () where T: NSObject, IProtocol { /* default implementation */ } } ``` Also add documentation and tests.
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.
🔥 [CI Build] Test results 🔥Test results❌ Tests failed on VSTS: test results 0 tests crashed, 81 tests failed, 94 tests passed. Failures❌ dotnettests tests (macOS)
Html Report (VSDrops) Download ❌ framework tests
Html Report (VSDrops) Download ❌ fsharp tests
Html Report (VSDrops) Download ❌ interdependent-binding-projects tests
Html Report (VSDrops) Download ❌ introspection tests
Html Report (VSDrops) Download ❌ linker tests
|
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.
🔥 [CI Build] Test results 🔥Test results❌ Tests failed on VSTS: test results 0 tests crashed, 77 tests failed, 92 tests passed. Failures❌ dotnettests tests (macOS) [attempt 2]
Html Report (VSDrops) Download ❌ framework tests [attempt 2]
Html Report (VSDrops) Download ❌ fsharp tests [attempt 2]
Html Report (VSDrops) Download ❌ interdependent-binding-projects tests [attempt 2]
Html Report (VSDrops) Download ❌ introspection tests [attempt 2]
Html Report (VSDrops) Download ❌ linker tests [attempt 2]
|
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 needs #20568 merged first. |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good!
[Export ("initWithValue:")] | ||
IntPtr Constructor (IntPtr value); | ||
|
||
[BindAs ("Create")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you meant Bind
here instead of BindAs
[BindAs ("Create")] | |
[Bind ("Create")] |
At least that is the attribute used in your tests and if I am reading it correctly also is the one you are looking for in the generator.
[Bind ("Create")]
[Export ("initWithCustomName:")]
NativeHandle Constructor (NSDate error);
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.
🔥 Unable to find the contents for the comment: D:\a\1\a\change-detection\results\gh-comment.md does not exist :fire Pipeline on Agent |
📚 [PR Build] Artifacts 📚Packages generatedView packagesPipeline on Agent |
❌ [PR Build] Tests on macOS X64 - Mac Sonoma (14) failed ❌Failed tests are:
Pipeline on Agent |
❌ [PR Build] Tests on macOS M1 - Mac Big Sur (11) failed ❌Failed tests are:
Pipeline on Agent |
❌ [PR Build] Tests on macOS M1 - Mac Ventura (13) failed ❌Failed tests are:
Pipeline on Agent |
❌ [PR Build] Tests on macOS M1 - Mac Monterey (12) failed ❌Failed tests are:
Pipeline on Agent |
❌ [CI Build] Windows Integration Tests failed ❌❌ Failed ❌ Pipeline on Agent |
🔥 [CI Build] Test results 🔥Test results❌ Tests failed on VSTS: test results 0 tests crashed, 15 tests failed, 155 tests passed. Failures❌ cecil tests
Html Report (VSDrops) Download ❌ dotnettests tests (MacCatalyst)
Html Report (VSDrops) Download ❌ dotnettests tests (macOS)
Html Report (VSDrops) Download ❌ dotnettests tests (tvOS)
Html Report (VSDrops) Download ❌ interdependent-binding-projects tests
Html Report (VSDrops) Download ❌ monotouch tests (iOS)
Html Report (VSDrops) Download ❌ monotouch tests (MacCatalyst)
Html Report (VSDrops) Download ❌ monotouch tests (macOS)
Html Report (VSDrops) Download ❌ monotouch tests (tvOS)
Html Report (VSDrops) Download Successes✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
Add support for binding constructors in protocols.
Given the api definition:
we're binding it like this:
Also add documentation and tests.
Fixes #14039.