Skip to content

fix: generate AppKit BindCommand bindings that compile against ObjCRuntime.Selector - #150

Merged
glennawatson merged 1 commit into
mainfrom
fix/appkit-bindcommand-selector
Sep 27, 2026
Merged

glennawatson merged 1 commit into
mainfrom
fix/appkit-bindcommand-selector

Conversation

@glennawatson

@glennawatson glennawatson commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A generated BindCommand to an AppKit control now compiles on macOS.

  • The AppKit command binding no longer disposes its selector. The generated code assigns new ObjCRuntime.Selector("theAction:") to the control's Action and clears it on detach. It no longer calls Dispose(), which ObjCRuntime.Selector does not have.

Why

Binding a command to an NSButton, or any other AppKit target/action control, failed to compile with CS1061.

Breaking changes

None.

How this was verified

The native command tests now use a Selector stand-in with the real type's shape, so the old call no longer compiles.

  • By hand: ran the generator on the example's NSButton BindCommand call and compiled the output against the real Microsoft.macOS.dll reference assembly with no errors. No Apple host was available to run it.

Notes for the reviewer

The whole change is AppKitCommandEmitter.

  • The test fixture change only removes IDisposable from the fake ObjCRuntime.Selector.

Checklist

  • I have read the Contribute guide
  • The PR title follows Conventional Commits
  • Tests cover this change, or the summary says why they do not
  • New or changed public API has XML documentation

@glennawatson
glennawatson enabled auto-merge (squash) September 27, 2026 08:52
@codecov

codecov Bot commented Sep 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.20%. Comparing base (938828f) to head (0f95499).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sonarqubecloud

Copy link
Copy Markdown

@glennawatson
glennawatson merged commit 07b217d into main Sep 27, 2026
22 checks passed
@glennawatson
glennawatson deleted the fix/appkit-bindcommand-selector branch September 27, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant