unoplatform / uno

Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
https://platform.uno
Apache License 2.0
9.06k stars 735 forks source link

Add validation/analyzer for ResourceDictionary usage with single items on WinUI #18915

Open kazo0 opened 3 days ago

kazo0 commented 3 days ago

What would you like to be added

Related WinUI issue: https://github.com/microsoft/microsoft-ui-xaml/issues/8832

There is a longstanding issue on Windows when attempting to merge a ResourceDictionary that contains a single resource defined (such as a ResDict file with a single Style or StaticResource defined).

These single-resource dictionaries are somehow stripped away and can lead to crashes due to cannot find resource with the Name/Key ... exceptions or with a generic COMExceptions.

Although this is only a Windows issue and does not fail for Uno-based platforms, we should be able to detect these ResourceDictionary usages and log/warn that this may fail when running the WinAppSdk head.