unoplatform / uno

Build Mobile, Desktop and WebAssembly apps with C# and XAML. Today. Open source and professionally supported.
https://platform.uno
Apache License 2.0
8.75k stars 706 forks source link

`ComboBox` will freeze about 5s when items popup #11386

Open zhongjohnson opened 1 year ago

zhongjohnson commented 1 year ago

Current behavior

When the ComboBox shows the items popup (dropdown) for the first time, it will freeze around 5s before clickable, after 5s, there will be scrollbar display then the items panel become clickable, user can select one of the item.

freeze

Expected behavior

There should be no "freeze" when items popup.

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

<controls:DataGrid x:Name="dataGrid">
    <controls:DataGrid.Columns>
        <controls:DataGridTextColumn  />
        <controls:DataGridComboBoxColumn x:Name="snoozeColumn" />
        <controls:DataGridTextColumn  />
    </controls:DataGrid.Columns>
</controls:DataGrid>

...

snoozeColumn.ItemsSource = new List { "1", "2", "3"};

Workaround

No response

Works on UWP/WinUI

None

Environment

No response

NuGet package version(s)

Uno.WinUI.Skia.Wpf 4.6.19

Affected platforms

Skia (WPF)

IDE

Visual Studio 2022

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

No response

jeromelaban commented 1 year ago

Thanks for the report. Can you provide a repro sample to show the issue? You can attach it as a zip file to the issue.

zhongjohnson commented 1 year ago

I just upgraded to Uno.WinUI.Skia.Wpf 4.7.44, seems the issue has been fixed, there is no "freeze" anymore. this issue can be closed then.

zhongjohnson commented 1 year ago

Sorry, I got new findings. the issue is not fixed in new release. If I set the default font, the combobox will become freeze for first popup.

Application.Current.Resources["ContentControlThemeFontFamily"] = new FontFamily("Microsoft YaHei");

zhongjohnson commented 1 year ago

UnoComboBoxTest.zip

Sample code attached.

zhongjohnson commented 1 year ago

It should be a issue with Font loading, I tried other font, there is no such issue.

Application.Current.Resources["ContentControlThemeFontFamily"] = "SimSun";

jeromelaban commented 1 year ago

Thanks for the repro. Unfortunately, I'm not able to reproduce the issue (I tried on my youtube stream today).

If the application is freezing, could you provide a VS CPU profiler trace that may show where the issue is?

zhongjohnson commented 1 year ago

@jeromelaban thank you so much for your time and patient for doing the test on the youtube stream, after watched your stream I doubt if is there any problem with my computer, so I tried on the other computer, I met the same issue. I will do more tests for the next step if there is any update information I will upload here.

zhongjohnson commented 1 year ago

I tested the same code on different machines, I found that it seems related to the performance of the machine, it happens with my 2 laptops, but it works well on my desktop pc (the performance of CPU and GPU is much better the laptops). hope there is any clue with it. it was strange that I didn't see much CPU or GPU occupation when the application freeze.

jeromelaban commented 1 year ago

@zhongjohnson I'm still interested in any kind of performance profiling that you could provide with VS.

zhongjohnson commented 1 year ago

image It looks like the CPU usage is abnormal, it's not too high, but really increase a lot. please check attached profiler data. Report20230301-0935.zip

jeromelaban commented 1 year ago

Thanks for the update. This looks like some related WPF issue. You may want to enable "external code" in the settings (either in the profiler setting at the beginning, or in the "settings" menu on the right of your screenshot).