Skip to content
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

Add AppContext switch 'UseSystemRenderingModeAsDefault' for StatusStrip #12624

Conversation

LeafShi1
Copy link
Member

@LeafShi1 LeafShi1 commented Dec 11, 2024

Fixes #12616

Proposed changes

  • Add an opt-out AppContext switch 'UseSystemRenderingModeAsDefault' for StatusStrip control to restore the default value that was used in the past (.NET Framework to .NET8). The problem with that default value was that it wasn't accessible. Our goal is to have default versions of our control as accessible as possible without the knowledge of business logic.

Customer Impact

  • Customer can use the switch UseSystemRenderingModeAsDefault decide whether to use the ToolStripRenderMode.System as the default painting style for the StatusStrip control

Regression?

  • Yes

Risk

  • Minimal

Screenshots

Before

A white line in the dialog when using StatusStrip
image

After

No extra white line the dialog
image

Test methodology

  • Unit test and manually

Test environment(s)

  • .net 10.0.0-alpha.1.24606.5
Microsoft Reviewers: Open in CodeFlow

Copy link

codecov bot commented Dec 11, 2024

Codecov Report

Attention: Patch coverage is 98.89381% with 5 lines in your changes missing coverage. Please review.

Project coverage is 76.00297%. Comparing base (c9c06a5) to head (7c9fce3).
Report is 11 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #12624         +/-   ##
===================================================
- Coverage   76.01450%   76.00297%   -0.01153%     
===================================================
  Files           3176        3177          +1     
  Lines         638840      638975        +135     
  Branches       47169       47175          +6     
===================================================
+ Hits          485611      485640         +29     
- Misses        149718      149829        +111     
+ Partials        3511        3506          -5     
Flag Coverage Δ
Debug 76.00297% <98.89381%> (-0.01153%) ⬇️
integration 18.12500% <0.00000%> (-0.01906%) ⬇️
production 49.77460% <90.00000%> (-0.02104%) ⬇️
test 97.03828% <99.09502%> (+0.00063%) ⬆️
unit 46.97451% <90.00000%> (-0.03876%) ⬇️

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

@lonitra lonitra added the 📭 waiting-author-feedback The team requires more information from the author label Dec 11, 2024
@ricardobossan
Copy link
Member

I proceeded to test this PR and it has fixed the issue:

image

Once colleagues comments are addressed, LGTM!

…eringModeAsDefault to UseSystemRenderingModeAsDefaultScope
@dotnet-policy-service dotnet-policy-service bot removed the 📭 waiting-author-feedback The team requires more information from the author label Dec 12, 2024
@Tanya-Solyanik Tanya-Solyanik changed the title Add AppContext switch 'UseSystemRenderingModeAsDefault' for StatuStrip Add AppContext switch 'UseSystemRenderingModeAsDefault' for StatusStrip Dec 12, 2024
Copy link
Member

@Tanya-Solyanik Tanya-Solyanik left a comment

Choose a reason for hiding this comment

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

Overall this is exactly what we suggested in the bug, but I see an issue in the designer scenario when the application sets the AppContext switch, but designer process does not read the application specific switch . Designer process will assume a different default value from the runtime scenario and the user will see different behavior in the designer surface and at the runtime. We should revisit the approach. I.e. default value will not be serialized into the .designer.cs file, and will be interpreted at control initialization time.

@@ -218,4 +220,13 @@ public static bool TreeNodeCollectionAddRangeRespectsSortOrder
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => GetCachedSwitchValue(TreeNodeCollectionAddRangeRespectsSortOrderSwitchName, ref s_treeNodeCollectionAddRangeRespectsSortOrder);
}

/// <summary>
/// Indicates whether to use ToolStripRenderMode.System as the default painting mode for StatusStrip.
Copy link
Member

Choose a reason for hiding this comment

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

Please use <see cref around the reference to our types.

Suggested change
/// Indicates whether to use ToolStripRenderMode.System as the default painting mode for StatusStrip.
/// Indicates whether to use <see cref="ToolStripRenderMode.System" /> as the default painting mode for <see cref="StatusStrip" />.

Copy link
Member Author

@LeafShi1 LeafShi1 Dec 13, 2024

Choose a reason for hiding this comment

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

Since the current project does not reference System.Windows.Forms, the StatusStrip class cannot be referenced correctly. So in order to make this change, I need to add a reference to System.Windows.Forms for the current project.

But it resulted in circular dependency issue
image

@Tanya-Solyanik
Copy link
Member

@LeafShi1 - Could you please experiment if we can fix the previous default rendermode - System- to be accessible, i.e. change the hover over color for example?

@LeafShi1
Copy link
Member Author

@LeafShi1 - Could you please experiment if we can fix the previous default rendermode - System- to be accessible, i.e. change the hover over color for example?

will do

@LeafShi1
Copy link
Member Author

@LeafShi1 - Could you please experiment if we can fix the previous default rendermode - System- to be accessible, i.e. change the hover over color for example?

We can change RenderMode to System when executing the Select method, please see the PR #12646

@LeafShi1 LeafShi1 added the waiting-review This item is waiting on review by one or more members of team label Dec 17, 2024
@LeafShi1 LeafShi1 closed this Dec 18, 2024
@dotnet-policy-service dotnet-policy-service bot removed the waiting-review This item is waiting on review by one or more members of team label Dec 18, 2024
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.

A unexpected white line in StatusStrip compoent in dotnet 9
4 participants