uno icon indicating copy to clipboard operation
uno copied to clipboard

[Skia] `SettingsExpander` freezes app

Open MartinZikmund opened this issue 1 year ago • 2 comments
trafficstars

Current behavior

Loading SettingsExpander freezes app completely

Expected behavior

Should not happen

How to reproduce it (as minimally and precisely as possible)

  1. Check out https://github.com/MartinZikmund/uno-bug-repros/tree/bug/settings-expander-freeze
  2. Try to run the desktop target
  3. Notice it never loads

Workaround

No response

Works on UWP/WinUI

None

Environment

No response

NuGet package version(s)

No response

Affected platforms

No response

IDE

No response

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

No response

MartinZikmund avatar Jun 26 '24 08:06 MartinZikmund

This is a templated parent bug that causes SettingsCard.Header to be set to the SettingsCard itself, causing a cycle in the tree then we get into an infinite loop while walking the tree up.

It all starts from ContentPresenter.SynchronizeContentTemplatedParent which sets the wrong TemplatedParent.

To elaborate more:

https://github.com/CommunityToolkit/Windows/blob/efbaf965029806fe29e02a6421af3c8f434e1460/components/SettingsControls/src/SettingsExpander/SettingsExpander.xaml#L87-L96

Here, SettingsCard.Header is bound to TemplatedParent.Header.

In this context, the correct TemplatedParent is SettingsExpander (NOT Expander)

BUT, ContentPresenter is setting its Content templated parent to Expander incorrectly.

This basically means that SettingsCard.TemplatedParent is becoming Expander.

So, when we set SettingCard.Header to TemplatedParent.Header while the templated parent is Expander, we end up setting SettingCard.Header to the SettingCard itself.

We either need to expose the FreezeTemplatedParent hack so that it's used in the implementation here: https://github.com/CommunityToolkit/Windows/blob/efbaf965029806fe29e02a6421af3c8f434e1460/components/SettingsControls/src/SettingsCard/SettingsCard.cs#L69, or we need to fix TemplatedParent.

Youssef1313 avatar Jun 27 '24 06:06 Youssef1313

This would likely be fixed by https://github.com/unoplatform/uno/issues/1621

jeromelaban avatar Jun 27 '24 12:06 jeromelaban