Skip to content

Fix issue 15139: FormRevealMode.Inherit always resolves to Classic instead of inheriting the expected reveal mode - #15156

Open
SimonZhao888 wants to merge 2 commits into
dotnet:mainfrom
SimonZhao888:Fix_Issue_15139
Open

SimonZhao888 wants to merge 2 commits into
dotnet:mainfrom
SimonZhao888:Fix_Issue_15139

Conversation

@SimonZhao888

@SimonZhao888 SimonZhao888 commented Sep 20, 2026 •

Copy link
Copy Markdown
Member

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

  • Preserve and return FormRevealMode.Inherit from the public property.
  • Introduce separate effective-mode resolution for runtime reveal behavior.
  • Use the effective mode when deciding whether DWM cloaking is required.
  • Add regression tests for both Classic → Inherit and Deferred → Inherit.

Customer Impact

  • Customers can now reliably configure and observe Inherit in code and the Visual Studio designer. Forms still inherit the application-level reveal behavior correctly, while explicit Classic and Deferred settings remain unchanged.

Regression?

  • No

Risk

  • Mini

Screenshots

Before

Recording.2026-09-20.104731.mp4

After

Recording.2026-09-20.104237.mp4
Recording.2026-09-20.104432.mp4

Test methodology

  • Manual

Test environment(s)

  • 11.0.0-rc.2.26469.104
Microsoft Reviewers: Open in CodeFlow

…stead of inheriting the expected reveal mode
@SimonZhao888
SimonZhao888 requested a review from a team as a code owner September 20, 2026 02:49
@SimonZhao888
SimonZhao888 requested review from LeafShi1 and ricardobossan and a lite review from Copilot and removed request for a team September 20, 2026 02:51

Copilot AI 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.

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 Medium severity

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.FormRevealMode getter to return the configured value (defaulting to Inherit) 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 Inherit round-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.

Comment thread src/test/unit/System.Windows.Forms/System/Windows/Forms/FormTests.RevealMode.cs Outdated
@codecov

codecov Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 37.24166%. Comparing base (75072a6) to head (50456a7).

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           
Flag Coverage Δ
Debug 37.24166% <ø> (ø)
production 39.36526% <ø> (ø)
test 20.64923% <ø> (ø)
unit 39.36526% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@LeafShi1 LeafShi1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

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.

FormRevealMode.Inherit always resolves to Classic instead of inheriting the expected reveal mode

3 participants