Open Youssef1313 opened 1 year ago
I tried to see if I could repo but the app does not build using
dotnet build XamlBrewerUnoApp.Mobile.csproj -bl
error UXAML0001: The type initializer for 'Uno.UI.SourceGenerators.XamlGenerator.XamlCodeGeneration' threw an exception.
error CS0103: The name 'InitializeComponent' does not exist in the current context
error CS1061: 'PythagorasTreePage' does not contain a definition for 'InitializeComponent' and no accessible extension method 'InitializeComponent' accepting a first argument of type 'PythagorasTreePage' could be found (are you missing a using directive or an assembly reference?)
error CS0103: The name 'Root' does not exist in the current context
It's strange. It's building perfectly fine in CI. What exception did XamlCodeGeneration throw?
One thing I noticed is that this task might be doing extra work because we are building in Release where AddKeepAlives is true. So I was suspecting this to be what is taking lots of time. I blindly opened a performance optimization but it might still not be where the task is spending most of its time https://github.com/xamarin/xamarin-android/pull/8422.
LinkAssembliesNoShrink
should not run in Release, that is a Debug Task.
Might be worth checking the properties for AndroidLinkMode
in your build log to see why its running that task in Release when it should be running the normal .net linker.
Ah, AndroidLinkMode
is None
. That is because we explicitly pass PublishTrimmed
to false. I think we did that to actually make the build faster
Note: Setting AndroidAddKeepAlives
to false takes it down from 9 minutes to 3 seconds.
Note: Setting
AndroidAddKeepAlives
to false takes it down from 9 minutes to 3 seconds.
So, are we testing Debug
or Release
builds? We are generally more interested in improving build times for Debug
builds.
The <LinkAssembliesNoShrink/>
task normally runs when the linker/trimmer is disabled (Debug
mode).
However, $(AndroidKeepAlives)
is only true in a Release
build by default:
$(AndroidIncludeDebugSymbols)
is based on DebugSymbols=true
or DebugType
being set.
I was going to look into skipping AddKeepAlives()
for any assembly that is newer than MonoAndroid12.0
. But I don't see this code path even hit in a dotnet new maui
project build.
@Youssef1313 do you have a .binlog
of a build where you were seeing this? Was it, perhaps, Release
mode?
@Youssef1313 your picture above is Release
mode:
Do you have trimming disabled in this app?
@jonpryor Yes, it's the release build in CI.
We should look into further optimizing AddKeepAlivesStep.cs
/etc. to only process assemblies built against Xamarin.Android 11.1 or older, as those versions lack #5278.
Android application type
.NET Android (net7.0-android, etc.)
Affected platform version
Android 33.0.46
Description
This is very very slow.
Steps to Reproduce
Build the app in https://github.com/unoplatform/Uno.Samples/pull/584
Did you find any workaround?
No response
Relevant log output
No response