Skip to content

[Settings] Decouple Settings.UI.Library from PowerDisplay.Lib to fix …#46325

Merged
moooyo merged 1 commit intomainfrom
yuleng/hotfix/1
Mar 24, 2026
Merged

[Settings] Decouple Settings.UI.Library from PowerDisplay.Lib to fix …#46325
moooyo merged 1 commit intomainfrom
yuleng/hotfix/1

Conversation

@moooyo
Copy link
Contributor

@moooyo moooyo commented Mar 20, 2026

Summary of the Pull Request

Fixes PowerToys Run crash (FileNotFoundException for PowerDisplay.Lib.dll) caused by Settings.UI.Library having a transitive dependency on PowerDisplay.Lib.

SettingsSerializationContext registered PowerDisplay profile types (PowerDisplayProfile, PowerDisplayProfiles, ProfileMonitorSetting) via [JsonSerializable] attributes, which forced the CLR to load PowerDisplay.Lib.dll at startup. PowerToys Run depends on Settings.UI.Library but does not ship PowerDisplay.Lib.dll, causing the crash.

PR Checklist

  • Communication: I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected
  • Tests: Added/updated and all pass
  • Localization: All end-user-facing strings can be localized
  • Dev docs: Added/updated
  • New binaries: Added on the required places
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

<ProjectReference Include="..\..\..\common\ManagedCsWin32\ManagedCsWin32.csproj" />
<ProjectReference Include="..\..\..\common\interop\PowerToys.Interop.vcxproj" />
</ItemGroup>
<Import Project="..\PowerDisplay.Models\PowerDisplay.Models.projitems" Label="Shared" />

Check failure

Code scanning / check-spelling

Unrecognized Spelling

[projitems](#security-tab) is not a recognized word. \(unrecognized-spelling\)
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>

Check failure

Code scanning / check-spelling

Check File Path

[projitems](#security-tab) is not a recognized word. \(check-file-path\)
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
<Import Project="PowerDisplay.Models.projitems" Label="Shared" />

Check failure

Code scanning / check-spelling

Unrecognized Spelling

[projitems](#security-tab) is not a recognized word. \(unrecognized-spelling\)
<ProjectReference Include="..\..\modules\powerdisplay\PowerDisplay.Lib\PowerDisplay.Lib.csproj" />
</ItemGroup>

<Import Project="..\..\modules\powerdisplay\PowerDisplay.Models\PowerDisplay.Models.projitems" Label="Shared" />

Check failure

Code scanning / check-spelling

Unrecognized Spelling

[projitems](#security-tab) is not a recognized word. \(unrecognized-spelling\)
…PowerToys Run crash

PowerToys Run crashes with FileNotFoundException for PowerDisplay.Lib.dll
because SettingsSerializationContext registers PowerDisplay.Lib types,
forcing the runtime to load the assembly even when not needed.

- Add local copies of ColorPresetItem and CustomVcpValueMapping in
  Settings.UI.Library (namespace Microsoft.PowerToys.Settings.UI.Library)
  to avoid dependency on PowerDisplay.Lib
- Remove Settings.UI.Library ProjectReference to PowerDisplay.Lib
- Remove unused PowerDisplay profile type registrations from
  SettingsSerializationContext (they use their own ProfileSerializationContext)
- Inline ColorTemperatureHelper logic in MonitorInfo.cs
- Add using alias in Settings.UI to disambiguate CustomVcpValueMapping types

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@moooyo
Copy link
Contributor Author

moooyo commented Mar 24, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@moooyo moooyo marked this pull request as ready for review March 24, 2026 06:15
@moooyo moooyo added the 0.98.1 label Mar 24, 2026
@moooyo
Copy link
Contributor Author

moooyo commented Mar 24, 2026

This is a temp fix for 0.98 crash issue. Will put more effort later to make codebase more maintainable

@niels9001

@moooyo moooyo enabled auto-merge (squash) March 24, 2026 06:58
@moooyo moooyo merged commit 0d41d45 into main Mar 24, 2026
22 checks passed
@moooyo moooyo deleted the yuleng/hotfix/1 branch March 24, 2026 07:49
zateutsch added a commit that referenced this pull request Mar 25, 2026
Cherry-picked commits:
- Make KBM Editor pinnable (#46482)
- CmdPal: Fix missing primary context command for late-bound items (#46131)
- CmdPal: Ensure DockWindow property cleans up after itself (#46303)
- CmdPal: Hotfix commonCallbacks array initial count to prevent negative number (#46215)
- CmdPal: Fix missing app context menu actions on the main page (#46293)
- CmdPal: Fix dock popup XamlRoot handling on DockControl (#46305)
- CmdPal: Reduce DockWindow backdrop switching and visual artifacts (#46309)
- Always On Top: The opacity should be able to configure the hotkey individually (#46410)
- [OOBE] Ensure the Settings button on the SCOOBE page opens Home, not a blank page (#46203)
- CmdPal: Fix scroller scrolling and down glyph (#46447)
- [Settings] Decouple Settings.UI.Library from PowerDisplay.Lib to fix (#46325)
@zateutsch zateutsch added the Product-Settings The standalone PowerToys Settings application label Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0.98.1 Product-Settings The standalone PowerToys Settings application

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] PowerToys Run crashes on startup/settings load with missing PowerDisplay.Lib in v0.98.0

3 participants