Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SkiaSharp (or LiveCharts) causes crash in release mode #11069

Closed
IgorKravchenko10 opened this issue Nov 2, 2022 · 6 comments
Closed

SkiaSharp (or LiveCharts) causes crash in release mode #11069

IgorKravchenko10 opened this issue Nov 2, 2022 · 6 comments
Labels
s/needs-attention Issue has more information and needs another look t/bug Something isn't working

Comments

@IgorKravchenko10
Copy link

IgorKravchenko10 commented Nov 2, 2022

Description

Hello!
I have a trouble with LiveCharts (LiveChartsCore.SkiaSharpView.Maui in NuGet).
First, it can't compile in release mode.
It says

NETSDK1144 Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false.
IL1011 Failed to write 'obj\Release\net7.0-android\android-arm64\linked\SkiaSharp.Views.Android.dll'.

After adding <AndroidLinkMode>None</AndroidLinkMode> to project file it compiles successfully but crashes after start.

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net7.0-android|AnyCPU'">
		<AndroidLinkMode>None</AndroidLinkMode>
		<AndroidPackageFormat>aab</AndroidPackageFormat>
		<AndroidUseAapt2>True</AndroidUseAapt2>
		<AndroidCreatePackagePerAbi>False</AndroidCreatePackagePerAbi>
	</PropertyGroup>

I don't know whose issue is it (Mono, MAUI or LiveCharts), so tell me please if I posting issue in wrong project.

Steps to Reproduce

  1. Create a new MAUI project (I use .NET 7, didn't test on .NET 6).
  2. Add LiveChartsCore.SkiaSharpView.Maui from NuGet.
  3. Call .UseSkiaSharp(true) from builder in MauiProgram.
  4. Try to compile in release mode.
  5. Ensure you have errors (Optimizing assemblies for size failed)
  6. Add <AndroidLinkMode>None</AndroidLinkMode> to project and try to run again.
  7. Ensure it compiles successfully but crashes after start.

Link to public reproduction project repository

https://github.com/IgorKravchenko10/LiveChartsOrSkiaCrash

Version with bug

7.0 Release Candidate 2

Last version that worked well

Unknown/Other

Affected platforms

Android, I was not able test on other platforms

Affected platform versions

Android 7, Android 12

Did you find any workaround?

No response

Relevant log output

Build started...
1>------ Build started: Project: LiveChartsOrSkiaCrash, Configuration: Release Any CPU ------
1>C:\Program Files\dotnet\sdk\7.0.100-rc.2.22477.23\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(257,5): message NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
1>C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash.csproj : warning NU1603: LiveChartsOrSkiaCrash depends on Microsoft.Extensions.Configuration (>= 7.0.0-rc.2.22430.11) but Microsoft.Extensions.Configuration 7.0.0-rc.2.22430.11 was not found. An approximate best match of Microsoft.Extensions.Configuration 7.0.0-rc.2.22472.3 was resolved.
1>C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash.csproj : warning NU1603: LiveChartsOrSkiaCrash depends on Microsoft.Extensions.DependencyInjection (>= 7.0.0-rc.2.22430.11) but Microsoft.Extensions.DependencyInjection 7.0.0-rc.2.22430.11 was not found. An approximate best match of Microsoft.Extensions.DependencyInjection 7.0.0-rc.2.22472.3 was resolved.
1>C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash.csproj : warning NU1603: LiveChartsOrSkiaCrash depends on Microsoft.Extensions.Logging (>= 7.0.0-rc.2.22430.11) but Microsoft.Extensions.Logging 7.0.0-rc.2.22430.11 was not found. An approximate best match of Microsoft.Extensions.Logging 7.0.0-rc.2.22472.3 was resolved.
1>C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash.csproj : warning NU1603: LiveChartsOrSkiaCrash depends on Microsoft.Extensions.Logging.Abstractions (>= 7.0.0-rc.2.22430.11) but Microsoft.Extensions.Logging.Abstractions 7.0.0-rc.2.22430.11 was not found. An approximate best match of Microsoft.Extensions.Logging.Abstractions 7.0.0-rc.2.22472.3 was resolved.
1>C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash.csproj : warning NU1603: LiveChartsOrSkiaCrash depends on Microsoft.Extensions.Logging.Debug (>= 7.0.0-rc.2.22430.11) but Microsoft.Extensions.Logging.Debug 7.0.0-rc.2.22430.11 was not found. An approximate best match of Microsoft.Extensions.Logging.Debug 7.0.0-rc.2.22472.3 was resolved.
1>Skipping analyzers to speed up the build. You can execute 'Build' or 'Rebuild' command to run analyzers.
1>LiveChartsOrSkiaCrash -> C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\bin\Release\net7.0-android\LiveChartsOrSkiaCrash.dll
1>C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash.csproj : warning NU1603: LiveChartsOrSkiaCrash depends on Microsoft.Extensions.Configuration (>= 7.0.0-rc.2.22430.11) but Microsoft.Extensions.Configuration 7.0.0-rc.2.22430.11 was not found. An approximate best match of Microsoft.Extensions.Configuration 7.0.0-rc.2.22472.3 was resolved.
1>C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash.csproj : warning NU1603: LiveChartsOrSkiaCrash depends on Microsoft.Extensions.DependencyInjection (>= 7.0.0-rc.2.22430.11) but Microsoft.Extensions.DependencyInjection 7.0.0-rc.2.22430.11 was not found. An approximate best match of Microsoft.Extensions.DependencyInjection 7.0.0-rc.2.22472.3 was resolved.
1>C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash.csproj : warning NU1603: LiveChartsOrSkiaCrash depends on Microsoft.Extensions.Logging (>= 7.0.0-rc.2.22430.11) but Microsoft.Extensions.Logging 7.0.0-rc.2.22430.11 was not found. An approximate best match of Microsoft.Extensions.Logging 7.0.0-rc.2.22472.3 was resolved.
1>C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash.csproj : warning NU1603: LiveChartsOrSkiaCrash depends on Microsoft.Extensions.Logging.Abstractions (>= 7.0.0-rc.2.22430.11) but Microsoft.Extensions.Logging.Abstractions 7.0.0-rc.2.22430.11 was not found. An approximate best match of Microsoft.Extensions.Logging.Abstractions 7.0.0-rc.2.22472.3 was resolved.
1>C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash.csproj : warning NU1603: LiveChartsOrSkiaCrash depends on Microsoft.Extensions.Logging.Debug (>= 7.0.0-rc.2.22430.11) but Microsoft.Extensions.Logging.Debug 7.0.0-rc.2.22430.11 was not found. An approximate best match of Microsoft.Extensions.Logging.Debug 7.0.0-rc.2.22472.3 was resolved.
1>C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash.csproj : warning NU1603: LiveChartsOrSkiaCrash depends on Microsoft.Extensions.Configuration (>= 7.0.0-rc.2.22430.11) but Microsoft.Extensions.Configuration 7.0.0-rc.2.22430.11 was not found. An approximate best match of Microsoft.Extensions.Configuration 7.0.0-rc.2.22472.3 was resolved.
1>C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash.csproj : warning NU1603: LiveChartsOrSkiaCrash depends on Microsoft.Extensions.DependencyInjection (>= 7.0.0-rc.2.22430.11) but Microsoft.Extensions.DependencyInjection 7.0.0-rc.2.22430.11 was not found. An approximate best match of Microsoft.Extensions.DependencyInjection 7.0.0-rc.2.22472.3 was resolved.
1>C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash.csproj : warning NU1603: LiveChartsOrSkiaCrash depends on Microsoft.Extensions.Logging (>= 7.0.0-rc.2.22430.11) but Microsoft.Extensions.Logging 7.0.0-rc.2.22430.11 was not found. An approximate best match of Microsoft.Extensions.Logging 7.0.0-rc.2.22472.3 was resolved.
1>C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash.csproj : warning NU1603: LiveChartsOrSkiaCrash depends on Microsoft.Extensions.Logging.Abstractions (>= 7.0.0-rc.2.22430.11) but Microsoft.Extensions.Logging.Abstractions 7.0.0-rc.2.22430.11 was not found. An approximate best match of Microsoft.Extensions.Logging.Abstractions 7.0.0-rc.2.22472.3 was resolved.
1>C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash.csproj : warning NU1603: LiveChartsOrSkiaCrash depends on Microsoft.Extensions.Logging.Debug (>= 7.0.0-rc.2.22430.11) but Microsoft.Extensions.Logging.Debug 7.0.0-rc.2.22430.11 was not found. An approximate best match of Microsoft.Extensions.Logging.Debug 7.0.0-rc.2.22472.3 was resolved.
1>Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
1>Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
1>Optimizing assemblies for size. This process might take a while.
1>Optimizing assemblies for size. This process might take a while.
1>C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash.csproj : warning NU1603: LiveChartsOrSkiaCrash depends on Microsoft.Extensions.Configuration (>= 7.0.0-rc.2.22430.11) but Microsoft.Extensions.Configuration 7.0.0-rc.2.22430.11 was not found. An approximate best match of Microsoft.Extensions.Configuration 7.0.0-rc.2.22472.3 was resolved.
1>C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash.csproj : warning NU1603: LiveChartsOrSkiaCrash depends on Microsoft.Extensions.DependencyInjection (>= 7.0.0-rc.2.22430.11) but Microsoft.Extensions.DependencyInjection 7.0.0-rc.2.22430.11 was not found. An approximate best match of Microsoft.Extensions.DependencyInjection 7.0.0-rc.2.22472.3 was resolved.
1>C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash.csproj : warning NU1603: LiveChartsOrSkiaCrash depends on Microsoft.Extensions.Logging (>= 7.0.0-rc.2.22430.11) but Microsoft.Extensions.Logging 7.0.0-rc.2.22430.11 was not found. An approximate best match of Microsoft.Extensions.Logging 7.0.0-rc.2.22472.3 was resolved.
1>C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash.csproj : warning NU1603: LiveChartsOrSkiaCrash depends on Microsoft.Extensions.Logging.Abstractions (>= 7.0.0-rc.2.22430.11) but Microsoft.Extensions.Logging.Abstractions 7.0.0-rc.2.22430.11 was not found. An approximate best match of Microsoft.Extensions.Logging.Abstractions 7.0.0-rc.2.22472.3 was resolved.
1>C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash.csproj : warning NU1603: LiveChartsOrSkiaCrash depends on Microsoft.Extensions.Logging.Debug (>= 7.0.0-rc.2.22430.11) but Microsoft.Extensions.Logging.Debug 7.0.0-rc.2.22430.11 was not found. An approximate best match of Microsoft.Extensions.Logging.Debug 7.0.0-rc.2.22472.3 was resolved.
1>C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash.csproj : warning NU1603: LiveChartsOrSkiaCrash depends on Microsoft.Extensions.Configuration (>= 7.0.0-rc.2.22430.11) but Microsoft.Extensions.Configuration 7.0.0-rc.2.22430.11 was not found. An approximate best match of Microsoft.Extensions.Configuration 7.0.0-rc.2.22472.3 was resolved.
1>C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash.csproj : warning NU1603: LiveChartsOrSkiaCrash depends on Microsoft.Extensions.DependencyInjection (>= 7.0.0-rc.2.22430.11) but Microsoft.Extensions.DependencyInjection 7.0.0-rc.2.22430.11 was not found. An approximate best match of Microsoft.Extensions.DependencyInjection 7.0.0-rc.2.22472.3 was resolved.
1>C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash.csproj : warning NU1603: LiveChartsOrSkiaCrash depends on Microsoft.Extensions.Logging (>= 7.0.0-rc.2.22430.11) but Microsoft.Extensions.Logging 7.0.0-rc.2.22430.11 was not found. An approximate best match of Microsoft.Extensions.Logging 7.0.0-rc.2.22472.3 was resolved.
1>C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash.csproj : warning NU1603: LiveChartsOrSkiaCrash depends on Microsoft.Extensions.Logging.Abstractions (>= 7.0.0-rc.2.22430.11) but Microsoft.Extensions.Logging.Abstractions 7.0.0-rc.2.22430.11 was not found. An approximate best match of Microsoft.Extensions.Logging.Abstractions 7.0.0-rc.2.22472.3 was resolved.
1>C:\Users\Igor\source\repos\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash\LiveChartsOrSkiaCrash.csproj : warning NU1603: LiveChartsOrSkiaCrash depends on Microsoft.Extensions.Logging.Debug (>= 7.0.0-rc.2.22430.11) but Microsoft.Extensions.Logging.Debug 7.0.0-rc.2.22430.11 was not found. An approximate best match of Microsoft.Extensions.Logging.Debug 7.0.0-rc.2.22472.3 was resolved.
1>Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
1>Optimizing assemblies for size. This process might take a while.
1>Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
1>Optimizing assemblies for size. This process might take a while.
1>ILLink : error IL1011: Failed to write 'obj\Release\net7.0-android\android-arm\linked\SkiaSharp.Views.Android.dll'.
1>Fatal error in IL Linker
1>Unhandled exception. Mono.Linker.LinkerFatalErrorException: ILLink: error IL1011: Failed to write 'obj\Release\net7.0-android\android-arm\linked\SkiaSharp.Views.Android.dll'.
1> ---> System.ArgumentException: Member 'System.Int32 SKCanvasView_ignorePixelScaling' is declared in another module and needs to be imported
1>   at Mono.Cecil.MetadataBuilder.LookupToken(IMetadataTokenProvider provider)
1>   at Mono.Cecil.Cil.CodeWriter.WriteOperand(Instruction instruction)
1>   at Mono.Cecil.Cil.CodeWriter.WriteInstructions()
1>   at Mono.Cecil.Cil.CodeWriter.WriteResolvedMethodBody(MethodDefinition method)
1>   at Mono.Cecil.Cil.CodeWriter.WriteMethodBody(MethodDefinition method)
1>   at Mono.Cecil.MetadataBuilder.AddMethod(MethodDefinition method)
1>   at Mono.Cecil.MetadataBuilder.AddMethods(TypeDefinition type)
1>   at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type)
1>   at Mono.Cecil.MetadataBuilder.AddTypes()
1>   at Mono.Cecil.MetadataBuilder.BuildTypes()
1>   at Mono.Cecil.MetadataBuilder.BuildModule()
1>   at Mono.Cecil.MetadataBuilder.BuildMetadata()
1>   at Mono.Cecil.ModuleWriter.<>c.<BuildMetadata>b__2_0(MetadataBuilder builder, MetadataReader _)
1>   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
1>   at Mono.Cecil.ModuleWriter.BuildMetadata(ModuleDefinition module, MetadataBuilder metadata)
1>   at Mono.Cecil.ModuleWriter.Write(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters)
1>   at Mono.Cecil.ModuleWriter.WriteModule(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters)
1>   at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters)
1>   at Mono.Cecil.AssemblyDefinition.Write(String fileName, WriterParameters parameters)
1>   at Mono.Linker.Steps.OutputStep.WriteAssembly(AssemblyDefinition assembly, String directory, WriterParameters writerParameters)
1>   --- End of inner exception stack trace ---
1>   at Mono.Linker.Steps.OutputStep.WriteAssembly(AssemblyDefinition assembly, String directory, WriterParameters writerParameters)
1>   at Mono.Linker.Steps.OutputStep.WriteAssembly(AssemblyDefinition assembly, String directory)
1>   at Mono.Linker.Steps.OutputStep.OutputAssembly(AssemblyDefinition assembly)
1>   at Mono.Linker.Steps.OutputStep.ProcessAssembly(AssemblyDefinition assembly)
1>   at Mono.Linker.Steps.BaseStep.Process(LinkContext context)
1>   at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
1>   at Mono.Linker.Pipeline.Process(LinkContext context)
1>   at Mono.Linker.Driver.Run(ILogger customLogger)
1>   at Mono.Linker.Driver.Main(String[] args)
1>ILLink : error IL1011: Failed to write 'obj\Release\net7.0-android\android-arm64\linked\SkiaSharp.Views.Android.dll'.
1>Fatal error in IL Linker
1>Unhandled exception. Mono.Linker.LinkerFatalErrorException: ILLink: error IL1011: Failed to write 'obj\Release\net7.0-android\android-arm64\linked\SkiaSharp.Views.Android.dll'.
1> ---> System.ArgumentException: Member 'System.Int32 SKCanvasView_ignorePixelScaling' is declared in another module and needs to be imported
1>   at Mono.Cecil.MetadataBuilder.LookupToken(IMetadataTokenProvider provider)
1>   at Mono.Cecil.Cil.CodeWriter.WriteOperand(Instruction instruction)
1>   at Mono.Cecil.Cil.CodeWriter.WriteInstructions()
1>   at Mono.Cecil.Cil.CodeWriter.WriteResolvedMethodBody(MethodDefinition method)
1>   at Mono.Cecil.Cil.CodeWriter.WriteMethodBody(MethodDefinition method)
1>   at Mono.Cecil.MetadataBuilder.AddMethod(MethodDefinition method)
1>   at Mono.Cecil.MetadataBuilder.AddMethods(TypeDefinition type)
1>   at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type)
1>   at Mono.Cecil.MetadataBuilder.AddTypes()
1>   at Mono.Cecil.MetadataBuilder.BuildTypes()
1>   at Mono.Cecil.MetadataBuilder.BuildModule()
1>   at Mono.Cecil.MetadataBuilder.BuildMetadata()
1>   at Mono.Cecil.ModuleWriter.<>c.<BuildMetadata>b__2_0(MetadataBuilder builder, MetadataReader _)
1>   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
1>   at Mono.Cecil.ModuleWriter.BuildMetadata(ModuleDefinition module, MetadataBuilder metadata)
1>   at Mono.Cecil.ModuleWriter.Write(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters)
1>   at Mono.Cecil.ModuleWriter.WriteModule(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters)
1>   at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters)
1>   at Mono.Cecil.AssemblyDefinition.Write(String fileName, WriterParameters parameters)
1>   at Mono.Linker.Steps.OutputStep.WriteAssembly(AssemblyDefinition assembly, String directory, WriterParameters writerParameters)
1>   --- End of inner exception stack trace ---
1>   at Mono.Linker.Steps.OutputStep.WriteAssembly(AssemblyDefinition assembly, String directory, WriterParameters writerParameters)
1>   at Mono.Linker.Steps.OutputStep.WriteAssembly(AssemblyDefinition assembly, String directory)
1>   at Mono.Linker.Steps.OutputStep.OutputAssembly(AssemblyDefinition assembly)
1>   at Mono.Linker.Steps.OutputStep.ProcessAssembly(AssemblyDefinition assembly)
1>   at Mono.Linker.Steps.BaseStep.Process(LinkContext context)
1>   at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
1>   at Mono.Linker.Pipeline.Process(LinkContext context)
1>   at Mono.Linker.Driver.Run(ILogger customLogger)
1>   at Mono.Linker.Driver.Main(String[] args)
1>ILLink : error IL1011: Failed to write 'obj\Release\net7.0-android\android-x64\linked\SkiaSharp.Views.Android.dll'.
1>Fatal error in IL Linker
1>Unhandled exception. Mono.Linker.LinkerFatalErrorException: ILLink: error IL1011: Failed to write 'obj\Release\net7.0-android\android-x64\linked\SkiaSharp.Views.Android.dll'.
1> ---> System.ArgumentException: Member 'System.Int32 SKCanvasView_ignorePixelScaling' is declared in another module and needs to be imported
1>   at Mono.Cecil.MetadataBuilder.LookupToken(IMetadataTokenProvider provider)
1>   at Mono.Cecil.Cil.CodeWriter.WriteOperand(Instruction instruction)
1>   at Mono.Cecil.Cil.CodeWriter.WriteInstructions()
1>   at Mono.Cecil.Cil.CodeWriter.WriteResolvedMethodBody(MethodDefinition method)
1>   at Mono.Cecil.Cil.CodeWriter.WriteMethodBody(MethodDefinition method)
1>   at Mono.Cecil.MetadataBuilder.AddMethod(MethodDefinition method)
1>   at Mono.Cecil.MetadataBuilder.AddMethods(TypeDefinition type)
1>   at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type)
1>   at Mono.Cecil.MetadataBuilder.AddTypes()
1>   at Mono.Cecil.MetadataBuilder.BuildTypes()
1>   at Mono.Cecil.MetadataBuilder.BuildModule()
1>   at Mono.Cecil.MetadataBuilder.BuildMetadata()
1>   at Mono.Cecil.ModuleWriter.<>c.<BuildMetadata>b__2_0(MetadataBuilder builder, MetadataReader _)
1>   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
1>   at Mono.Cecil.ModuleWriter.BuildMetadata(ModuleDefinition module, MetadataBuilder metadata)
1>   at Mono.Cecil.ModuleWriter.Write(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters)
1>   at Mono.Cecil.ModuleWriter.WriteModule(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters)
1>   at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters)
1>   at Mono.Cecil.AssemblyDefinition.Write(String fileName, WriterParameters parameters)
1>   at Mono.Linker.Steps.OutputStep.WriteAssembly(AssemblyDefinition assembly, String directory, WriterParameters writerParameters)
1>   --- End of inner exception stack trace ---
1>   at Mono.Linker.Steps.OutputStep.WriteAssembly(AssemblyDefinition assembly, String directory, WriterParameters writerParameters)
1>   at Mono.Linker.Steps.OutputStep.WriteAssembly(AssemblyDefinition assembly, String directory)
1>   at Mono.Linker.Steps.OutputStep.OutputAssembly(AssemblyDefinition assembly)
1>   at Mono.Linker.Steps.OutputStep.ProcessAssembly(AssemblyDefinition assembly)
1>   at Mono.Linker.Steps.BaseStep.Process(LinkContext context)
1>   at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
1>   at Mono.Linker.Pipeline.Process(LinkContext context)
1>   at Mono.Linker.Driver.Run(ILogger customLogger)
1>   at Mono.Linker.Driver.Main(String[] args)
1>ILLink : error IL1011: Failed to write 'obj\Release\net7.0-android\android-x86\linked\SkiaSharp.Views.Android.dll'.
1>Fatal error in IL Linker
1>Unhandled exception. Mono.Linker.LinkerFatalErrorException: ILLink: error IL1011: Failed to write 'obj\Release\net7.0-android\android-x86\linked\SkiaSharp.Views.Android.dll'.
1> ---> System.ArgumentException: Member 'System.Int32 SKCanvasView_ignorePixelScaling' is declared in another module and needs to be imported
1>   at Mono.Cecil.MetadataBuilder.LookupToken(IMetadataTokenProvider provider)
1>   at Mono.Cecil.Cil.CodeWriter.WriteOperand(Instruction instruction)
1>   at Mono.Cecil.Cil.CodeWriter.WriteInstructions()
1>   at Mono.Cecil.Cil.CodeWriter.WriteResolvedMethodBody(MethodDefinition method)
1>   at Mono.Cecil.Cil.CodeWriter.WriteMethodBody(MethodDefinition method)
1>   at Mono.Cecil.MetadataBuilder.AddMethod(MethodDefinition method)
1>   at Mono.Cecil.MetadataBuilder.AddMethods(TypeDefinition type)
1>   at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type)
1>   at Mono.Cecil.MetadataBuilder.AddTypes()
1>   at Mono.Cecil.MetadataBuilder.BuildTypes()
1>   at Mono.Cecil.MetadataBuilder.BuildModule()
1>   at Mono.Cecil.MetadataBuilder.BuildMetadata()
1>   at Mono.Cecil.ModuleWriter.<>c.<BuildMetadata>b__2_0(MetadataBuilder builder, MetadataReader _)
1>   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
1>   at Mono.Cecil.ModuleWriter.BuildMetadata(ModuleDefinition module, MetadataBuilder metadata)
1>   at Mono.Cecil.ModuleWriter.Write(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters)
1>   at Mono.Cecil.ModuleWriter.WriteModule(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters)
1>   at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters)
1>   at Mono.Cecil.AssemblyDefinition.Write(String fileName, WriterParameters parameters)
1>   at Mono.Linker.Steps.OutputStep.WriteAssembly(AssemblyDefinition assembly, String directory, WriterParameters writerParameters)
1>   --- End of inner exception stack trace ---
1>   at Mono.Linker.Steps.OutputStep.WriteAssembly(AssemblyDefinition assembly, String directory, WriterParameters writerParameters)
1>   at Mono.Linker.Steps.OutputStep.WriteAssembly(AssemblyDefinition assembly, String directory)
1>   at Mono.Linker.Steps.OutputStep.OutputAssembly(AssemblyDefinition assembly)
1>   at Mono.Linker.Steps.OutputStep.ProcessAssembly(AssemblyDefinition assembly)
1>   at Mono.Linker.Steps.BaseStep.Process(LinkContext context)
1>   at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
1>   at Mono.Linker.Pipeline.Process(LinkContext context)
1>   at Mono.Linker.Driver.Run(ILogger customLogger)
1>   at Mono.Linker.Driver.Main(String[] args)
1>C:\Program Files\dotnet\sdk\7.0.100-rc.2.22477.23\Sdks\Microsoft.NET.ILLink.Tasks\build\Microsoft.NET.ILLink.targets(86,5): error NETSDK1144: Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false.
1>Done building project "LiveChartsOrSkiaCrash.csproj" -- FAILED.
1>C:\Program Files\dotnet\sdk\7.0.100-rc.2.22477.23\Sdks\Microsoft.NET.ILLink.Tasks\build\Microsoft.NET.ILLink.targets(86,5): error NETSDK1144: Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false.
1>Done building project "LiveChartsOrSkiaCrash.csproj" -- FAILED.
1>C:\Program Files\dotnet\sdk\7.0.100-rc.2.22477.23\Sdks\Microsoft.NET.ILLink.Tasks\build\Microsoft.NET.ILLink.targets(86,5): error NETSDK1144: Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false.
1>Done building project "LiveChartsOrSkiaCrash.csproj" -- FAILED.
1>C:\Program Files\dotnet\sdk\7.0.100-rc.2.22477.23\Sdks\Microsoft.NET.ILLink.Tasks\build\Microsoft.NET.ILLink.targets(86,5): error NETSDK1144: Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false.
1>Done building project "LiveChartsOrSkiaCrash.csproj" -- FAILED.
1>Done building project "LiveChartsOrSkiaCrash.csproj" -- FAILED.
@IgorKravchenko10 IgorKravchenko10 added the t/bug Something isn't working label Nov 2, 2022
@rachelkang rachelkang added the s/needs-info Issue needs more info from the author label Nov 2, 2022
@ghost
Copy link

ghost commented Nov 2, 2022

Hi @IgorKravchenko10. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@rachelkang
Copy link
Member

Hi, @IgorKravchenko10 - Are you able to reproduce this issue with only SkiaSharp (without LiveCharts)? If so, could you post an updated repro? Thanks :)

@IgorKravchenko10
Copy link
Author

IgorKravchenko10 commented Nov 2, 2022

Hi, @IgorKravchenko10 - Are you able to reproduce this issue with only SkiaSharp (without LiveCharts)? If so, could you post an updated repro? Thanks :)

Hi, Rachel.
I didn't tested it with SkiaSharp only. Because I really don't know what exact package should I use =)
I mean I don't know exact name of package in NuGet.
P. S. I have added SkiaSharp.Views.Maui.Controls and have the same issue. Also uploaded changes in repo.
Thanks for response.

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author labels Nov 2, 2022
@IgorKravchenko10
Copy link
Author

Hi!
I just want to say I updated repo.
Thanks.

@PureWeen
Copy link
Member

PureWeen commented Nov 3, 2022

Duplicate of dotnet/sdk#28880

@IgorKravchenko10
Copy link
Author

Update: adding <AndroidLinkResources>false</AndroidLinkResources> to project file helped. Thanks, @jonathanpeppers
Note, <AndroidLinkMode>None</AndroidLinkMode> must be removed because it is still crashes after start.
So, the solution or workaround for now is to add <AndroidLinkResources>false</AndroidLinkResources> and remove <AndroidLinkMode>None</AndroidLinkMode>.
P. S. My issue cannot be duplicate of dotnet/sdk#28880 because I created this earlier but it's OK =)

@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
s/needs-attention Issue has more information and needs another look t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants