-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix issue 14094: After reducing the form width, clicking the ToolStrip options triggers a Win32Exception error #14244
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull request overview
Fixes Win32Exception when ToolStripControlHost-hosted controls (e.g., ToolStripComboBox/ToolStripProgressBar) move into the overflow drop-down after the form is narrowed, by ensuring the ToolStrip parent has a handle before reparenting hosted controls.
Changes:
- Update
ToolStripControlHost.SyncControlParent()to create the ToolStrip parent handle when the hosted control handle already exists. - Add a regression test covering moving hosted controls with existing handles into the overflow drop-down without throwing.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/System.Windows.Forms/System/Windows/Forms/Controls/ToolStrips/ToolStripControlHost.cs | Ensures the ToolStrip parent handle exists before adding the hosted control to the ToolStrip’s control collection. |
| src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripControlHostTests.cs | Adds a regression test intended to reproduce/guard against the overflow reparenting Win32Exception scenario. |
src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripControlHostTests.cs
Show resolved
Hide resolved
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.
LGTM! The failed tests need to be addressed.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #14244 +/- ##
===================================================
+ Coverage 77.17712% 77.17980% +0.00267%
===================================================
Files 3279 3279
Lines 645129 645161 +32
Branches 47728 47730 +2
===================================================
+ Hits 497892 497934 +42
+ Misses 143544 143528 -16
- Partials 3693 3699 +6
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Fixes #14094
Proposed changes
Customer Impact
Regression?
Risk
-Min
Screenshots
Before
After
Bug14094.mp4
Test methodology
Test environment(s)
Microsoft Reviewers: Open in CodeFlow