Windows icon indicating copy to clipboard operation
Windows copied to clipboard

[SettingsExpander] Unhandled "Unspecified error" exception

Open tipa opened this issue 1 year ago • 1 comments

Describe the bug

When using a SettingsExpander that is bound to an ObservableCollection in a page that is not cached (NavigationCacheMode="Disabled") and this page is repeatedly opened (and old instances of the page have been garbage collected), the app crashes once an item of that ObservableCollection is removed.

Steps to reproduce

Download and run this test project : Test.zip

Expected behavior

No crash. When adding NavigationCacheMode="Required" to Page2, the crash is not happening

Code Platform

  • [x] WinAppSDK / WinUI 3

Windows Build Number

  • [x] Windows 11 21H2 (Build 22000)

App minimum and target SDK version

  • [x] Windows 10, version 1809 (Build 17763)

Visual Studio Version

2022

Help us help you

No, I'm unable to contribute a solution.

tipa avatar Jan 30 '25 12:01 tipa

The ItemsRepeater inside the SettingsExpander is causing this issue, so you can see the same exception with a plain ItemsRepeater.

I found this issue (microsoft/microsoft-ui-xaml#7639) but it's closed. Leaving a comment there might help reopening it.

You can avoid this exception by setting ItemsSource to null when the SettingsControl is unloaded.

AndrewKeepCoding avatar Jan 31 '25 01:01 AndrewKeepCoding