CommunityToolkit / WindowsCommunityToolkit

The Windows Community Toolkit is a collection of helpers, extensions, and custom controls. It simplifies and demonstrates common developer tasks building .NET apps with UWP and the Windows App SDK / WinUI 3 for Windows 10 and Windows 11. The toolkit is part of the .NET Foundation.
https://docs.microsoft.com/windows/communitytoolkit/
Other
5.88k stars 1.38k forks source link

WinUI 3: ThemeListener crashes #3656

Open ocalvo opened 3 years ago

ocalvo commented 3 years ago

Describe the bug

Creating ThemeListener crashes

Steps to Reproduce

Steps to reproduce the behavior:

  1. Create a new WinUI3 Desktop app using version latest internal version on WinUI3
  2. Add a reference to WCT preview 3:
    1. Write this code in App.xaml.cs:
  protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
  {
     var t = new Microsoft.Toolkit.Uwp.UI.Helpers.ThemeListener();
  1. F5

Expected behavior

App does not crash.

Screenshots

If applicable, add screenshots to help explain your problem.

Environment

NuGet Package(s): 
8.0.0-preview3

Package Version(s): 
WinUI3 latest internal version

Windows 10 Build Number:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [x] May 2020 Update (19041)
- [ ] Insider Build (build number: )

App min and target version:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [x] May 2019 Update (18362)
- [ ] May 2020 Update (19041)
- [ ] Insider Build (xxxxx)

Device form factor:
- [x] Desktop
- [ ] Xbox
- [ ] Surface Hub
- [ ] IoT

Visual Studio 
- [ ] 2017 (version: )
- [ ] 2019 (version: ) 
- [x] 2019 Preview (version: 2)

Additional context

Add any other context about the problem here.

ghost commented 3 years ago

Hello ocalvo, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

Marv51 commented 3 years ago

Probably related to this entry in the WinUI 3 release note: "The UISettings.ColorValuesChanged Event and AccessibilitySettings.HighContrastChanged Event are no longer supported in desktop apps. This may cause issues if you are using it to detect changes in Windows themes."