Conversation
|
good job |
| $CheckBox = $sync.configs.tweaks.$CheckBox | ||
| } | ||
|
|
||
| Write-Debug "Tweaks: $($CheckBox)" |
There was a problem hiding this comment.
Yea it make sense. The only place $CheckBox change would be used is here:
Write-Debug "Tweaks: $($CheckBox)"and i would argue it makes debug not easier if you change
WPFToggleDarkMode with System.Collections.Hashtable+SyncHashtable.configs.tweaks.WPFToggleDarkMode
Or am i wrong?
because for dark mode toggle is..
- the value of
$CheckBox->WPFToggleDarkMode - the value of
$sync.configs.tweaks.$CheckBox->System.Collections.Hashtable+SyncHashtable.configs.tweaks.WPFToggleDarkMode
There was a problem hiding this comment.
Yea it make sense. The only place
$CheckBoxchange would be used is here:Write-Debug "Tweaks: $($CheckBox)"and i would argue it makes debug not easier if you change
WPFToggleDarkModewithSystem.Collections.Hashtable+SyncHashtable.configs.tweaks.WPFToggleDarkModeOr am i wrong?
because for dark mode toggle is..
the value of
$CheckBox->WPFToggleDarkModethe value of
$sync.configs.tweaks.$CheckBox->System.Collections.Hashtable+SyncHashtable.configs.tweaks.WPFToggleDarkMode
Yes it makes the debug log more complicated for no good reason
Type of Change
Description
Starting in version 25.11.17, Customize Preferences toggles stopped working (see #3736). The issue has started from commit 25c5247 (introduced in PR #3625).
I've realized from testing that before this change, when the condition was still
$Checkbox -contains "Toggle", that the correspondingifwas never called because$Checkboxis always a string (whether tweak or toggle), thus-containsalways returned$false.Changing from
-containsto-likethus made the if statement's code execute for toggles. If you look at what it is doing, it sets$CheckBoxto$sync.configs.tweaks.$CheckBox(object), but then later on the code continues to use$CheckBoxin lines like$sync.configs.tweaks.$CheckBoxas if it were a string, thus making the code fail for toggles since they are now objects.I thus looked for the source of this if statement appearance in 1d0e3bf (PR #3014). When looking at the
Invoke-WinUtilTweaks.ps1file, this if statement is added (in a broken form like I said before since-containsis always$falsein this context), while$sync.configs.tweaks.$CheckBoxcode lines already exist and are left untouched.In conclusion, it is likely this if block has been there by error doing nothing up until now, where it's behavior has been enabled by 25c5247, resulting in broken functionality. This PR removes this if statement, since no other parts of the code use this sort of logic (from what I've found, the code always uses the
$sync.configs.tweaks.*pattern expecting a string).Testing
Tested
-contains,-like, and no if block configurations in Windows Sandbox.-containsworked fine,-likebroke toggles, no if statement worked fine.Impact
No impact
Issue related to PR
Additional Information
The #3625 PR adding this change claims their commit fixed an issue where selecting the "Set Classic Right-Click Menu" tweak would result in the script applying registry changes for the "Cross-Device Resume" tweak instead.
I have not been able to reproduce this issue in any of the tested configurations. Either this bug has been fixed by another PR, or it is not linked to this if block.
Checklist