Skip to content

Ignore Dynamic Resource Opt out Preferences #10794

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

Merged
merged 1 commit into from
Apr 22, 2025

Conversation

harshit7962
Copy link
Member

@harshit7962 harshit7962 commented Apr 22, 2025

Description

The changes here are intended to disregard developers' preferences regarding the DisableDynamicResourceOptimization switch. Regardless of the value set for this app context switch, the goal is to execute the code path that includes the recent optimizations introduced in #10532. This is because the optimizations will be part of the preview release, and our aim is to gather as many hits as possible.

cc:/ @batzen

Regression

None

Testing

Local Build Pass

Risk

By enforcing the execution of the optimized code path, we might encounter unforeseen issues that could have been mitigated using the switch. However, collecting such issues is beneficial to refine the optimizations before the final release, if needed.

Microsoft Reviewers: Open in CodeFlow

@Copilot Copilot AI review requested due to automatic review settings April 22, 2025 06:44
@harshit7962 harshit7962 requested review from a team as code owners April 22, 2025 06:44
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enforces the use of the dynamic resource optimization code path regardless of the developer’s opt-out setting. The changes modify several conditionals to always bypass the opt-out branch and update the default switch value accordingly.

  • In ResourceReferenceExpression.cs, the removal code is now wrapped in an unreachable "if (false)" block with appropriate pragmas.
  • In ResourceDictionary.cs, similar modifications are applied to disable the opt-out logic across multiple methods.
  • In AppContextDefaultValues.cs, the default value of the DisableDynamicResourceOptimization switch is changed from true to false.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ResourceReferenceExpression.cs Replaced the conditional opt-out check with an unreachable branch using pragmas.
src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ResourceDictionary.cs Applied the unreachable branch pattern in multiple resource-related methods to enforce optimizations.
src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/AppContextDefaultValues.cs Updated the default value of the dynamic resource optimization switch.

@dotnet-policy-service dotnet-policy-service bot added the PR metadata: Label to tag PRs, to facilitate with triage label Apr 22, 2025
Copy link

codecov bot commented Apr 22, 2025

Codecov Report

Attention: Patch coverage is 36.00000% with 16 lines in your changes missing coverage. Please review.

Project coverage is 13.53328%. Comparing base (5edc518) to head (7c4a9f7).
Report is 7 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #10794         +/-   ##
===================================================
+ Coverage   13.47139%   13.53328%   +0.06189%     
===================================================
  Files           3317        3317                 
  Lines         665596      665537         -59     
  Branches       74679       74666         -13     
===================================================
+ Hits           89665       90069        +404     
+ Misses        573326      572870        -456     
+ Partials        2605        2598          -7     
Flag Coverage Δ
Debug 13.53328% <36.00000%> (+0.06189%) ⬆️

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.

@harshit7962 harshit7962 merged commit 508c792 into dotnet:main Apr 22, 2025
8 checks passed
@harshit7962
Copy link
Member Author

/backport to release/10.0-preview4

Copy link

Started backporting to release/10.0-preview4: https://github.com/dotnet/wpf/actions/runs/14591755428

Copy link

@harshit7962 backporting to "release/10.0-preview4" failed, the patch most likely resulted in conflicts:

$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Ignore DR Optimization preferences
.git/rebase-apply/patch:55: trailing whitespace.
                        
.git/rebase-apply/patch:68: trailing whitespace.
            
.git/rebase-apply/patch:89: trailing whitespace.
            
.git/rebase-apply/patch:225: trailing whitespace.
                
warning: 4 lines add whitespace errors.
Using index info to reconstruct a base tree...
M	src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ResourceDictionary.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ResourceDictionary.cs
CONFLICT (content): Merge conflict in src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ResourceDictionary.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Ignore DR Optimization preferences
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR metadata: Label to tag PRs, to facilitate with triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants