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

[BUG] .NET 9 Android: "Assembly 'SkiaSharp' produced trim warnings" #3042

Closed
1 task done
tipa opened this issue Oct 19, 2024 · 7 comments
Closed
1 task done

[BUG] .NET 9 Android: "Assembly 'SkiaSharp' produced trim warnings" #3042

tipa opened this issue Oct 19, 2024 · 7 comments

Comments

@tipa
Copy link

tipa commented Oct 19, 2024

Description

I am seeing build warnings when compiling my app with .NET 9 RC 2 for Android.
Example project: test.zip

Code

In a .NET 9 Android project, add this:

[Register("test.ChartView")]
sealed partial class ChartView : SKCanvasView
{
    public ChartView(Context context, IAttributeSet attributes) : base(context) { }
}

You can also share some XAML:

<ItemGroup>
  <PackageReference Include="SkiaSharp.Views" Version="3.0.0-preview.4.1" />
</ItemGroup>

Expected Behavior

No warnings

Actual Behavior

C:\Users\me\.nuget\packages\skiasharp.views\3.0.0-preview.4.1\lib\net7.0-android33.0\SkiaSharp.Views.Android.dll : warning IL2104: Assembly 'SkiaSharp.Views.Android' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries
C:\Users\me\.nuget\packages\skiasharp\3.0.0-preview.4.1\lib\net7.0-android33.0\SkiaSharp.dll : warning IL2104: Assembly 'SkiaSharp' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries

Version of SkiaSharp

3.x-preview.4.1 (Current Preview)

Platform / Operating System

Android

Code of Conduct

  • I agree to follow this project's Code of Conduct
@tipa tipa added the type/bug label Oct 19, 2024
@charlesroddie
Copy link

You need to put <TrimmerSingleWarn>false</TrimmerSingleWarn> in your project file to see the detailed warnings.

@tipa
Copy link
Author

tipa commented Oct 22, 2024

These are the detailed warnings:

ILLink : Trim analysis warning IL2122: SkiaSharp: Type 'SkiaSharp.Resource' is not assembly qualified. Type name strings used for dynamically accessing a type should be assembly qualified.
ILLink : Trim analysis warning IL2122: SkiaSharp.Views.Android: Type 'SkiaSharp.Views.Android.Resource' is not assembly qualified. Type name strings used for dynamically accessing a type should be assembly qualified.

Just to be clear, my app works well, I'd just like to have a warning-free build :)

@mattleibow
Copy link
Contributor

@jonathanpeppers thoughts?

@jonathanpeppers
Copy link
Member

You need to rebuild for .NET 8.

@mattleibow
Copy link
Contributor

@tipa Do the warning still appear if you build using the latest SkiaSharp preview? That was built with .NET 8.

@tipa
Copy link
Author

tipa commented Oct 30, 2024

No, warning seems to have disappeared

@mattleibow
Copy link
Contributor

Thanks for letting me know. I will close this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants