Repository navigation
fix: generate AppKit BindCommand bindings that compile against ObjCRuntime.Selector - #150
Merged
Merged
Conversation
glennawatson
enabled auto-merge (squash)
September 27, 2026 08:52
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #150 +/- ##
=======================================
Coverage 99.20% 99.20%
=======================================
Files 385 385
Lines 14265 14263 -2
Branches 2018 2018
=======================================
- Hits 14151 14150 -1
+ Misses 114 113 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
A generated
BindCommandto an AppKit control now compiles on macOS.new ObjCRuntime.Selector("theAction:")to the control'sActionand clears it on detach. It no longer callsDispose(), whichObjCRuntime.Selectordoes not have.Why
Binding a command to an
NSButton, or any other AppKit target/action control, failed to compile with CS1061.Dispose()on anObjCRuntime.Selector. That type has noDisposein any macOS reference assembly from net8.0 to net11.0.BindCommandUnsafebecause of this. Once a release carries this fix, it can useBindCommand.Breaking changes
None.
How this was verified
The native command tests now use a
Selectorstand-in with the real type's shape, so the old call no longer compiles.NSButtonBindCommandcall and compiled the output against the realMicrosoft.macOS.dllreference assembly with no errors. No Apple host was available to run it.Notes for the reviewer
The whole change is
AppKitCommandEmitter.IDisposablefrom the fakeObjCRuntime.Selector.Checklist