mono / SkiaSharp

SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library. It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
MIT License
4.47k stars 538 forks source link

[iOS, 3.0] Building projects with SkiaSharp hang up in Release configuration in .NET MAUI 9.0 Preview 6 and Visual Studio 17.11.0 Preview 4.0 #2953

Open janne-hmp opened 3 months ago

janne-hmp commented 3 months ago

Description

When using Visual Studio 17.11.0 Preview 4.0 to build a project using .NET MAUI 9.0 Preview 6 and SkiaSharp in Release configuration, the build process hangs up indefinitely in AOT compilation. Debug configuration works fine. Other platforms work fine. Xamarin iOS works fine. Both SkiaSharp 3.0 Preview 3.1 and 4.1 hang up, so it is not about SkiaSharp version.

Code

  1. Try to build https://github.com/hyvanmielenpelit/iOSMauiSkiaSharpMemoryLeak in Release configuration using .NET MAUI 9.0 Preview 6 and Visual Studio 17.11.0 Preview 4.0 (using Rebuild)
  2. The build process hangs up indefinitely in AOT compilation. In Debug configuration, it does not hang up.

Expected Behavior

The build process succeeds in Release configuration.

Actual Behavior

The build process hangs up indefinitely in AOT compilation step in Release configuration.

Version of SkiaSharp

3.x (Alpha)

Last Known Good Version of SkiaSharp

Other (Please indicate in the description)

IDE / Editor

Visual Studio (Windows)

Platform / Operating System

iOS

Platform / Operating System Version

iOS 17.5.1, but did not get that far

Devices

iPad 11,7 but did not get that far

Relevant Screenshots

No response

Relevant Log Output

1>        Done building target "IncrementalClean" in project "SkiaSharpMemoryLeak.csproj".
1>        Target "PostBuildEvent" skipped, due to false condition; ('$(PostBuildEvent)' != '' and ('$(RunPostBuildEvent)' != 'OnOutputUpdated' or '$(_AssemblyTimestampBeforeCompile)' != '$(_AssemblyTimestampAfterCompile)')) was evaluated as ('' != '' and ('' != 'OnOutputUpdated' or '' != '')).
1>        Target "GenerateBuildDependencyFile" skipped. Previously built successfully.
1>        Target "GenerateBuildRuntimeConfigurationFiles" skipped. Previously built successfully.
1>        Target "CoreBuild" in file "C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets":
1>        Done building target "CoreBuild" in project "SkiaSharpMemoryLeak.csproj".
1>        Target "AfterBuild" in file "C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets":
1>        Done building target "AfterBuild" in project "SkiaSharpMemoryLeak.csproj".
1>        Target "_CheckBrowserWorkloadNeededButNotAvailable" skipped, due to false condition; ('$(RuntimeIdentifier)' == 'browser-wasm' and '$(_BrowserWorkloadDisabled)' != 'true' and '$(WasmNativeWorkloadAvailable)' != 'true') was evaluated as ('win10-x64' == 'browser-wasm' and '' != 'true' and '' != 'true').
1>        Target "_ErrorWorkloadDisabledForTFMLessThan6" skipped, due to false condition; ('$(_BrowserWorkloadNotSupportedForTFM)' == 'true') was evaluated as ('' == 'true').
1>        Target "_ErrorDualWasmThreadPropsOn7" skipped, due to false condition; ('$(TargetsNet7)' == 'true' and '$(RuntimeIdentifier)' == 'browser-wasm' and
1>            '$(BrowserWorkloadDisabled)' != 'true' and '$(WasmEnableThreads)' == 'true' and '$(WasmEnablePerfTrace)' == 'true') was evaluated as ('' == 'true' and 'win10-x64' == 'browser-wasm' and
1>            '' != 'true' and '' == 'true' and '' == 'true').
1>        Target "Build" in file "C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets":
1>        Done building target "Build" in project "SkiaSharpMemoryLeak.csproj".
1>        Target "CallPublishContainerSdkContainerProfile" skipped, due to false condition; ('$(EnableSdkContainerDebugging)' == 'true' AND '$(SdkContainerPublishOnBuild)' == 'true') was evaluated as ('' == 'true' AND '' == 'true').
1>        Target "_CalculatePostXamarinTelemetry" skipped. Previously built successfully.
1>        Target "_PostXamarinTelemetry" skipped. Previously built successfully.
1>        Target "RestorePackageVersion" skipped, due to false condition; ('$(InteractiveExperiencesVersion)'!='') was evaluated as (''!='').
1>        Target "_PackAsBuildAfterTarget" skipped, due to false condition; ('$(GeneratePackageOnBuild)' == 'true' AND '$(IsInnerBuild)' != 'true') was evaluated as ('false' == 'true' AND 'true' != 'true').
1>        Target "_CheckContainersPackage" in file "C:\Program Files\dotnet\sdk\9.0.100-preview.6.24328.19\Containers\build\Microsoft.NET.Build.Containers.targets":
1>          Set Property: _ContainersPackageIdentity=Microsoft.NET.Build.Containers
1>          Set Property: _WebDefaultSdkVersion=7.0.300
1>          Set Property: _WorkerDefaultSdkVersion=8.0.100
1>          Set Property: _ConsoleDefaultSdkVersion=8.0.200
1>          Set Property: _SdkCanPublishWeb=True
1>          Set Property: _SdkCanPublishWorker=True
1>          Set Property: _SdkCanPublishConsole=True
1>          Set Property: _ContainerPackageIsPresent=false
1>          Set Property: _IsWebProject=false
1>          Set Property: _IsWorkerProject=false
1>          Task "Warning" skipped, due to false condition; ($(_ContainerPackageIsPresent)
1>                  and (
1>                    ($(_SdkCanPublishWeb) and $(_IsWebProject)) or
1>                    ($(_SdkCanPublishWorker) and $(_IsWorkerProject)) or
1>                    ($(_SdkCanPublishConsole) and '$(EnableSdkContainerSupport)' == 'true')
1>                  )) was evaluated as (false
1>                  and (
1>                    (True and false) or
1>                    (True and false) or
1>                    (True and '' == 'true')
1>                  )).
1>        Done building target "_CheckContainersPackage" in project "SkiaSharpMemoryLeak.csproj".
1>        Target "AfterRebuild" in file "C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets":
1>        Done building target "AfterRebuild" in project "SkiaSharpMemoryLeak.csproj".
1>        Target "_CheckForInvalidConfigurationAndPlatform" skipped. Previously built successfully.
1>        Target "Rebuild" in file "C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets":
1>        Done building target "Rebuild" in project "SkiaSharpMemoryLeak.csproj".
1>
1>        Done building project "SkiaSharpMemoryLeak.csproj".
1>        [xma][info]: Pinging client 'Broker'...
1>        [xma][info]: Sending Request Xamarin.Messaging.PingMessage to topic xma/ping/Broker
1>        [xma][info]: Received Response of Xamarin.Messaging.PingMessage to topic build3160817324janne/+/xma/ping/Broker
1>        [xma][info]: The client 'Broker' has acknowledged the ping
1>        [xma][info]: Pinging client 'Broker'...
1>        [xma][info]: Sending Request Xamarin.Messaging.PingMessage to topic xma/ping/Broker
1>        [xma][info]: Received Response of Xamarin.Messaging.PingMessage to topic build3160817324janne/+/xma/ping/Broker
1>        [xma][info]: The client 'Broker' has acknowledged the ping
1>        [xma][info]: Pinging client 'Broker'...
1>        [xma][info]: Sending Request Xamarin.Messaging.PingMessage to topic xma/ping/Broker
1>        [xma][info]: Received Response of Xamarin.Messaging.PingMessage to topic build3160817324janne/+/xma/ping/Broker
1>        [xma][info]: The client 'Broker' has acknowledged the ping
1>        [xma][info]: Pinging client 'Broker'...
1>        [xma][info]: Sending Request Xamarin.Messaging.PingMessage to topic xma/ping/Broker
1>        [xma][info]: Received Response of Xamarin.Messaging.PingMessage to topic build3160817324janne/+/xma/ping/Broker
1>        [xma][info]: The client 'Broker' has acknowledged the ping

Never finishes, ping continues forever in Release.

Code of Conduct

janne-hmp commented 3 months ago

@mattleibow Any workarounds I could try here? Does anybody get iOS Release build with SkiaSharp in Preview 6 working?

janne-hmp commented 2 months ago

It turns out you need to add <MtouchUseLlvm>False</MtouchUseLlvm> to the project file, and it then builds fine. Obviously, LLVM optimizations are not working then, but at least the build process finishes then successfully.