Skip to content

Replace obsolete OnClosing override in LanguageChoosingDialog - #173

Merged
imnasnainaec merged 1 commit into
masterfrom
language-choosing-dialog-onformclosing
Oct 8, 2026
Merged

imnasnainaec merged 1 commit into
masterfrom
language-choosing-dialog-onformclosing

Conversation

@imnasnainaec

@imnasnainaec imnasnainaec commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Split out of #165 (see this comment): with the net10.0-windows target, LanguageChoosingDialog.OnClosing triggers CS0672/WFDEV004 because Form.OnClosing is obsolete in modern WinForms.

  • Overrides OnFormClosing(FormClosingEventArgs) instead, with the same body. OnFormClosing dates from .NET 2.0, so no #if is needed for net462/net48.
  • Behavior is unchanged on the paths this dialog uses: the OK button (Close()), the X button and Alt+F4 raise both Closing and FormClosing. FormClosing additionally fires on Application.Exit / owner shutdown, where Closing did not.
  • The assignment deliberately stays in the closing hook instead of moving to _OKButton_Click; otherwise, closing via X would return null from ChooseFallbackLanguageWinforms.
  • Adds LanguageChoosingDialogTests.Close_SetsSelectedLanguageFromComboBox. It passes on net462, net48 and net8.0-windows, and fails if the assignment is removed.

No public API change, so no +semver marker.

🤖 Generated with Claude Code


This change is Reviewable

Form.OnClosing is obsolete in modern WinForms (CS0672/WFDEV004 on
net10.0-windows); OnFormClosing is the replacement and exists on every
target framework. Adds a test that SelectedLanguage is populated on close.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

Test Results

    7 files  ±0  154 suites  +3   28s ⏱️ +8s
232 tests +1  227 ✔️ +1    5 💤 ±0  0 ❌ ±0 
896 runs  +3  881 ✔️ +3  15 💤 ±0  0 ❌ ±0 

Results for commit 0e259bb. ± Comparison against base commit 4612f1c.

@imnasnainaec imnasnainaec self-assigned this Oct 8, 2026
@imnasnainaec
imnasnainaec marked this pull request as ready for review October 8, 2026 14:26

@andrew-polk andrew-polk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@andrew-polk reviewed 2 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on imnasnainaec).

@imnasnainaec
imnasnainaec merged commit caf2d3a into master Oct 8, 2026
7 checks passed
@imnasnainaec
imnasnainaec deleted the language-choosing-dialog-onformclosing branch October 8, 2026 16:21
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.

2 participants