Skip to content

Closes #5369: Cannot move Bind/PlatformKeyBinding to Input namespace (binary compat blocker)#5372

Closed
Copilot wants to merge 2 commits into
developfrom
copilot/fix-namespace-bind-platformkeybinding
Closed

Closes #5369: Cannot move Bind/PlatformKeyBinding to Input namespace (binary compat blocker)#5372
Copilot wants to merge 2 commits into
developfrom
copilot/fix-namespace-bind-platformkeybinding

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 22, 2026

Summary

This PR was created to move Bind and PlatformKeyBinding from namespace Terminal.Gui to namespace Terminal.Gui.Input per #5369.

Finding: Binary Compatibility Blocker

Both types cannot be moved because the Terminal.Gui.Editor NuGet package (all published versions through 2.2.5) has compiled IL metadata referencing:

  • Terminal.Gui.Bind
  • Terminal.Gui.PlatformKeyBinding

Moving either type to Terminal.Gui.Input causes System.TypeLoadException at runtime in the NativeAot smoke test (which instantiates the Editor).

Why standard workarounds don't apply:

  • [TypeForwardedTo] only works across assemblies, not for namespace changes within the same assembly
  • Type aliases don't exist in C# at the declaration level
  • Shim records fail because Bind.All() returns PlatformKeyBinding instances that can't implicitly upcast to a derived shim type

Resolution path:

  1. First update gui-cs/Editor to reference Terminal.Gui.Input.Bind and Terminal.Gui.Input.PlatformKeyBinding
  2. Publish a new Editor NuGet package
  3. Then this namespace move can proceed

Current state

The PR branch has no net code changes (the move was reverted after discovering the blocker). This PR documents the issue for #5369.

Recommendation: Close this PR and track the dependency update in #5369.

Copilot AI assigned Copilot and tig May 22, 2026
Copilot AI linked an issue May 22, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix namespace for Bind and PlatformKeyBinding Fixes #3988. Move Bind and PlatformKeyBinding to Terminal.Gui.Input namespace May 22, 2026
Copilot finished work on behalf of tig May 22, 2026 16:42
Copilot AI requested a review from tig May 22, 2026 16:42
@tig tig marked this pull request as ready for review May 22, 2026 16:58
@tig tig changed the title Fixes #3988. Move Bind and PlatformKeyBinding to Terminal.Gui.Input namespace Fixes #5369. Move Bind and PlatformKeyBinding to Terminal.Gui.Input namespace May 22, 2026
@tig tig requested review from BDisp and harder May 22, 2026 16:58
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 89bfb9863b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Terminal.Gui/Input/Keyboard/Bind.cs Outdated
@BDisp
Copy link
Copy Markdown
Collaborator

BDisp commented May 22, 2026

Be aware of failing tests.

Move only the Bind static class to namespace Terminal.Gui.Input to match its
directory location and sibling types (Key, KeyBinding, KeyBindings, etc.).

PlatformKeyBinding remains in namespace Terminal.Gui for now because the
external Terminal.Gui.Editor NuGet package (v2.2.1-develop.133) has compiled
IL referencing Terminal.Gui.PlatformKeyBinding. Moving it would cause
TypeLoadException at runtime. PlatformKeyBinding will be moved in a follow-up
once the Editor package is updated.

Partial fix for #5369.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tig tig force-pushed the copilot/fix-namespace-bind-platformkeybinding branch from eed955a to 1efc47d Compare May 22, 2026 18:06
@tig tig changed the title Fixes #5369. Move Bind and PlatformKeyBinding to Terminal.Gui.Input namespace Fixes #5369. Move Bind to Terminal.Gui.Input namespace May 22, 2026
…l.Gui.Bind

The Terminal.Gui.Editor NuGet package has compiled IL references to both
Terminal.Gui.Bind and Terminal.Gui.PlatformKeyBinding. Moving either type
to Terminal.Gui.Input causes System.TypeLoadException at runtime in the
NativeAot smoke test.

Until the Editor package is recompiled against the new namespace, these
types cannot be moved without breaking binary compatibility.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tig tig changed the title Fixes #5369. Move Bind to Terminal.Gui.Input namespace Closes #5369: Cannot move Bind/PlatformKeyBinding to Input namespace (binary compat blocker) May 22, 2026
@tig tig closed this May 23, 2026
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.

Terminal.Gui.Bind and PlatformKeyBinding are in the wrong namespace

3 participants