unoplatform / uno

Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
https://platform.uno
Apache License 2.0
9.04k stars 734 forks source link

[Xamarin] Uno 4.6 and later makes the linker step longer to run #10286

Closed Marc-Antoine-Soucy closed 1 year ago

Marc-Antoine-Soucy commented 2 years ago

Current behavior

When building the basic uno app template with the latest Uno.Ui nugget, it takes around 10-15 minutes to deploy the app on a physical device

Expected behavior

It should take around the same time than the latest stable nugget (1-2min)

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

BuildTimeTest.zip (this is the basic uno app template with IOS deployment enabled and with latest prerelease uno nuggets)

Build on an IOS physical device with latest stable. Notice it take around 1-2 minutes.

Update nugget to latest unstable and delete bin & obj, notice it takes around 10-15 minutes to build the same app

Workaround

I don't know any

Works on UWP/WinUI

Yes

Environment

Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia

NuGet package version(s)

`

<PackageReference Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" Version="4.6.0-dev.984" />`

Affected platforms

iOS

IDE

Visual Studio 2022

IDE version

17.3.6

Relevant plugins

No response

Anything else we need to know?

The build seems to be stuck at build4dd42f8392a87d32eb8552348c66f5efa9b4477561d104008d50d6b5cf21697818528masou/+/xma/ping/Broker (TaskId:235) 1> [xma][info]: The client 'Broker' has acknowledged the ping (TaskId:235) 1> [xma][info]: Pinging client 'Broker'... (TaskId:235) 1> [xma][info]: Sending Request Xamarin.Messaging.PingMessage to topic xma/ping/Broker (TaskId:235) 1> [xma][info]: Received Response of Xamarin.Messaging.PingMessage to topic

which it repeats for most of the time of the build

jeromelaban commented 2 years ago

Thanks. Can you provide a binlog?

Marc-Antoine-Soucy commented 2 years ago

buildLog1.zip Are the logs from the problematic build sufficient? Or do you also want the log with the latest stable release nuggets?

jeromelaban commented 2 years ago

Yes, if you can include the faster build it will help, thanks.

Marc-Antoine-Soucy commented 2 years ago

buildlog2.zip this is the normal one

vincentcastagna commented 1 year ago

I would add that we don't face this issue only for physical device (deploy) .The build increases regardless the target (simulator etc), without deploying

jeromelaban commented 1 year ago

This issue is the result of https://github.com/unoplatform/uno/pull/9808, where forcibly roslyn-based generatiopn was enabled for all targets which in turn is causing https://github.com/dotnet/linker/issues/1409 in older linker implementations (used by Xamarin).

The fix will likely be to use EmbedAllSources to false during Uno.UI's own build for Xamarin targets, so generated files don't get embedded into the symbols.

A mitigation is currently to disable the linker entirely, but the build time is still higher because there's lots more code to compile.

vincentcastagna commented 1 year ago

FYI : The fix was backported in Uno 4.6.39 .