Fix issue 15139: FormRevealMode.Inherit always resolves to Classic instead of inheriting the expected reveal mode - #15156
SimonZhao888 wants to merge 2 commits into
Conversation
…stead of inheriting the expected reveal mode
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The updated tests mutate process-wide Application.DefaultFormRevealMode and can become flaky under parallel test execution without additional isolation/coordination.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Fixes Form.FormRevealMode so the public property preserves the configured value (including Inherit) while runtime behavior uses a separately resolved “effective” reveal mode, addressing the issue where Inherit was immediately hidden by resolution to Classic.
Changes:
- Change
Form.FormRevealModegetter to return the configured value (defaulting toInherit) and introduce an internal effective-mode resolver for runtime behavior and change notifications. - Update the deferred-reveal cloaking decision to use the effective reveal mode rather than the public property value.
- Adjust and extend unit tests to validate
Inheritround-tripping and effective-mode behavior across application defaults.
| File | Description |
|---|---|
| src/test/unit/System.Windows.Forms/System/Windows/Forms/FormTests.RevealMode.cs | Updates tests to assert FormRevealMode returns Inherit by default and validates effective-mode behavior via accessor. |
| src/System.Windows.Forms/System/Windows/Forms/FormRevealMode.cs | Updates enum documentation to reflect Inherit being returned when no local override is set. |
| src/System.Windows.Forms/System/Windows/Forms/Form.RevealMode.cs | Changes FormRevealMode semantics (configured vs effective), adds effective-mode resolution, and uses it for deferred cloaking decisions. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #15156 +/- ##
=============================================
Coverage 37.24166% 37.24166%
=============================================
Files 246 246
Lines 9774 9774
Branches 1029 1029
=============================================
Hits 3640 3640
Misses 5970 5970
Partials 164 164
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|

Fixes #15139
Root Cause
Form.FormRevealMode returned the resolved effective mode instead of its configured value. Consequently, Inherit was immediately resolved to Classic when deferred reveal was not enabled, making Inherit invisible in both the runtime API and Properties window.
Proposed changes
Customer Impact
Regression?
Risk
Screenshots
Before
Recording.2026-09-20.104731.mp4
After
Recording.2026-09-20.104237.mp4
Recording.2026-09-20.104432.mp4
Test methodology
Test environment(s)
Microsoft Reviewers: Open in CodeFlow