[Android][MAUI-8.0.7] The CPU always maintains around 20%, even without any operation
Description
When there is a 'CollectionView' with property set to ItemsLayout="HorizontalList", the interface responds very slowly.CPU is always occupied, maintaining around 20%
Steps to Reproduce
Download https://github.com/BaY1251/MauiDebug.git
- Open /HorizontalList/HorizontalList.sln
- Change configuration to 'Release', and deployment the project
- Wait for 5 minutes, do not take any action during this period
- Command line input
adb shell top -n 1 | findstr "\<com.companyname.horizontallist\> \<PID\>"'to view CPU usage. - Waiting for what you think is a long enough time
- Command line input
adb shell top -n 1 | findstr "\<com.companyname.horizontallist\> \<PID\>"'to view CPU usage.
Link to public reproduction project repository
https://github.com/BaY1251/MauiDebug.git
Version with bug
8.0.7 SR2
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
8.0.6 SR1
Affected platforms
Android
Affected platform versions
Android7.1
Did you find any workaround?
No response
Relevant log output
No response
We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.
-
could not repro
-
all tests - 0%-3%
-
manual too
-
-
TODO: tests on another dev box (Mac x86) with net7.0, net8.0, net9.0
-
1000 samples - approx 1 sec each
-
tested
-
2 macs
-
M2
-
x86 i9
-
-
on
-
emulators
-
pixel5 device
I was not able
-
-
emulator-mac-m2-net8.0.top.processor.log.txt emulator-mac-m2-net7.0.top.processor.log.txt
repro sample
Mac M2 pixel5 net8.0
-
crash during start (needs investigation)
- workaround - nuke bin/ obj/
dotnet build \
./net8.0/ProjectsStructureTemplate.AppMAUI.DemoSample/ProjectsStructureTemplate.AppMAUI.DemoSample.csproj \
-t:run \
-f:net-8.0-android
adb shell top -n 1000 | grep "com.companyname" > pixel5--net8.0.top.processor.log
Could not redirect output to file. Redirecting hangs.
adb shell top -n 1000
Does not even list tested app
adb shell top -n 1000 | grep "com.companyname"
shows around 3% (constant)
20790 u0_a56 10 -10 14G 227M 121M S 1.3 3.0 0:04.22 com.companyname+
20790 u0_a56 10 -10 14G 227M 121M S 1.3 3.0 0:04.22 com.companyname+
Mac M2 emulator net8.0 - OK
dotnet build \
./net8.0/ProjectsStructureTemplate.AppMAUI.DemoSample/ProjectsStructureTemplate.AppMAUI.DemoSample.csproj \
-t:run \
-f:net-8.0-android
adb shell top -n 1000 | grep "com.companyname" > emulator-2--net8.0.top.processor.log
Mac M2 emulator net7.0 - OK
dotnet build \
./net7.0/ProjectsStructureTemplate.AppMAUI.DemoSample/ProjectsStructureTemplate.AppMAUI.DemoSample.csproj \
-t:run \
-f:net-7.0-android
adb shell top -n 1000 | grep "com.companyname" > emulator-2--net7.0.top.processor.log
@moljac
I noticed that my project seems to have been modified, please make sure to use <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.7" /> instead of <PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
Or, Can you directly deploy my project? I am certain that the issue introduced in the new version(8.0.7) occurred in Android 7.1, while the old version did not have this issue
I noticed that my project seems to have been modified,
yes. I have template for multi TFM tests. I tried your sample. There was some processor %, but not 20%.
I will paste logs today.
please make sure to use
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.7" />instead of<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
I will add those references to my projects.
Or, Can I directly deploy my project?
Can you? I guess you can. I did. Yes there was some % but not 20%.
The reason I use my template is to find possible regressions if any.
I am certain that the issue introduced in the new version(8.0.7) occurred in Android 7.1, while the old version did not have this issue
OK. Good to know. I will test more today.
OK. I was able to repro
with
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.7" />
it is not 20%, but 10% original sample and 12% for my sample.
18801 u0_a190 10 -10 14G 244M 114M S 33.6 12.3 14:57.95 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M R 33.6 12.3 14:58.96 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M R 34.0 12.3 14:59.97 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M S 34.6 12.3 15:00.99 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M S 34.0 12.3 15:02.03 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M R 33.3 12.3 15:03.05 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M S 34.3 12.3 15:04.05 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M R 34.6 12.3 15:05.08 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M R 34.3 12.3 15:06.12 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M S 33.6 12.3 15:07.15 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M S 34.3 12.3 15:08.16 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M R 33.6 12.3 15:09.19 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M R 34.6 12.3 15:10.20 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M S 34.3 12.3 15:11.24 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M R 34.0 12.3 15:12.27 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M S 34.0 12.3 15:13.29 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M R 33.3 12.3 15:14.31 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M R 35.0 12.3 15:15.31 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M R 34.3 12.3 15:16.36 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M R 34.6 12.3 15:17.39 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M S 35.3 12.3 15:18.43 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M R 35.0 12.3 15:19.49 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M S 34.3 12.3 15:20.54 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M R 32.6 12.3 15:21.57 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M R 24.3 12.3 15:22.55 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M R 24.3 12.3 15:23.28 com.companyname+
18801 u0_a190 10 -10 14G 244M 114M S 24.0 12.3 15:24.01 com.companyname+
Thank you very much. These data are sufficient to illustrate the issue, as other versions are close to 0%.
PS: 20% was the initial test, with a lot of interface elements to demonstrate slow interface response. Later, I found that the CPU was sufficient to explain the problem, so I will modify the title.
can repro in Net9 pre 2?
can repro in MAUI-8.0.20
This may not be just a problem with CollectionView. I tried using ScrollView+HorizontalStackLayout instead, but the problem still occurred.
Can you test with the latest nightly build? https://github.com/dotnet/maui/wiki/Nightly-Builds
I tested the repro here and I no longer see any ping ponging with the latest nightly
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.60-ci.net8.24272.1" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.60-ci.net8.24272.1" />
Yes, fixed by PR #22347