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

app crashes with latest SkiaSharp version #1722

Open
Th3L0x opened this issue Dec 6, 2024 · 9 comments
Open

app crashes with latest SkiaSharp version #1722

Th3L0x opened this issue Dec 6, 2024 · 9 comments
Milestone

Comments

@Th3L0x
Copy link

Th3L0x commented Dec 6, 2024

Describe the bug
The app crashes with error:

Could not load type of field 'LiveChartsCore.SkiaSharpView.Painting.ImageFilters.DropShadow:_cropRect' (6) due to: Could not resolve type with token 010000cf from typeref (expected class 'CropRect' in assembly '') assembly: type:CropRect member:(null)

with this livechart version:
<PackageReference Include="LiveChartsCore.SkiaSharpView.Maui" Version="2.0.0-beta.710" />

update these packages to:

<PackageReference Include="SkiaSharp.Views.Maui.Controls" Version="3.116.0" />
<PackageReference Include="SkiaSharp.Views.Maui.Core" Version="3.116.0" />

the error occures

revert these packages back to:

<PackageReference Include="SkiaSharp.Views.Maui.Controls" Version="2.88.9" />
<PackageReference Include="SkiaSharp.Views.Maui.Core" Version="2.88.9" />

its working again

To Reproduce
Place a polarchart in page, even an empty one like:
<lvc:PolarChart HeightRequest="100" WidthRequest="100" />

Expected behavior
Shows the polarchart without crash

Screenshots
If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device:
  • OS: Android
@Th3L0x Th3L0x changed the title getting error with new version app crashes with new SkiaSharp version Dec 6, 2024
@Th3L0x Th3L0x changed the title app crashes with new SkiaSharp version app crashes with latest SkiaSharp version Dec 6, 2024
@cloudhal
Copy link

Yes it does, what's the plan for supporting 3.x version of Skiasharp?

@beto-rodriguez
Copy link
Owner

The latest version of LiveCharts is compatible with SkiaSharp 3, it's impossible to make 2.0.0-beta.710 work, SkiaSharp 3 did not even existed when that version was released.

@cloudhal
Copy link

Thanks @beto-rodriguez , but if you install LiveChartsCore.SkiasharpView.Blazor, it installs SkiaSharp 2.8.8.9-preview.2.2 as a transitive package, upgrading to the latest 3.x versions of SkiSharp breaks it.

@Th3L0x
Copy link
Author

Th3L0x commented Jan 7, 2025

Same with LiveChartsCore.SkiaSharpView.Maui.

So which version and package should I use in MAUI if I want to update these:

<PackageReference Include="SkiaSharp.Views.Maui.Controls" Version="2.88.9" />
<PackageReference Include="SkiaSharp.Views.Maui.Core" Version="2.88.9" />

to these:

<PackageReference Include="SkiaSharp.Views.Maui.Controls" Version="3.116.0" />
<PackageReference Include="SkiaSharp.Views.Maui.Core" Version="3.116.0" />

Because if I use this package
<PackageReference Include="LiveChartsCore.SkiaSharpView.Maui" Version="2.0.0-beta.710" />
with these:

<PackageReference Include="SkiaSharp.Views.Maui.Controls" Version="3.116.0" />
<PackageReference Include="SkiaSharp.Views.Maui.Core" Version="3.116.0" />

then I get this error:
Could not load type of field 'LiveChartsCore.SkiaSharpView.Painting.ImageFilters.DropShadow:_cropRect' (6) due to: Could not resolve type with token 010000cf from typeref (expected class 'CropRect' in assembly '') assembly: type:CropRect member:(null)

@beto-rodriguez
Copy link
Owner

beto-rodriguez commented Jan 8, 2025

@cloudhal For Blazor please wait for rc-5 it should be available in a couple of days at NuGet

@Th3L0x try rc-4.5

@Th3L0x
Copy link
Author

Th3L0x commented Jan 10, 2025

Thank you rc-4.5 solved my issue!

@beto-rodriguez beto-rodriguez added this to the rc-5 milestone Jan 13, 2025
@beto-rodriguez
Copy link
Owner

This is now supported on the latest version of the library, thanks for the report.

@cloudhal
Copy link

Unfortunately it doesn't render now after upgrade:
System.NullReferenceException: Object reference not set to an instance of an object.
at SkiaSharp.Views.Blazor.SKGLView.Dispose()

@Th3L0x
Copy link
Author

Th3L0x commented Jan 16, 2025

I taked a closer look throughout. on 2.0.0-rc4.5

If I navigate from a page (with await Shell.Current.GoToAsync("..", animate: true)) that contains any chart I get this exception:

System.Exception: 'Unable to cast to ContentViewGroup'

[MIUIScout App] Enter APP_SCOUT_WARNING State
[MIUIScout App] (Current message: duration=2503ms seq=3776 late=12ms h=android.os.Handler c=mono.java.lang.RunnableImplementor)
[AppScoutStateMachine] dump trace dirName = 2025-01-16-11-43-27-7936-APP_SCOUT_WARNING-com.Tets.Test
[MIUIScout App] Event:APP_SCOUT_WARNING Thread:main backtrace:
[MIUIScout App] at mono.java.lang.RunnableImplementor.n_run(Native Method)
[MIUIScout App] at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:29)
[MIUIScout App] at android.os.Handler.handleCallback(Handler.java:958)
[MIUIScout App] at android.os.Handler.dispatchMessage(Handler.java:99)
[MIUIScout App] at android.os.Looper.loopOnce(Looper.java:222)
[MIUIScout App] at android.os.Looper.loop(Looper.java:314)
[MIUIScout App] at android.app.ActivityThread.main(ActivityThread.java:8680)
[MIUIScout App] at java.lang.reflect.Method.invoke(Native Method)
[MIUIScout App] at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:565)
[MIUIScout App] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
[MIUIScout App] Enter APP_SCOUT_HANG state
[MIUIScout App] (Current message: duration=5005ms seq=3776 late=12ms h=android.os.Handler c=mono.java.lang.RunnableImplementor)
[AppScoutStateMachine] dump trace dirName = 2025-01-16-11-43-30-7936-APP_SCOUT_HANG-com.Test.Test
[MIUIScout App] Event:APP_SCOUT_HANG Thread:main backtrace:
[MIUIScout App] at mono.java.lang.RunnableImplementor.n_run(Native Method)
[MIUIScout App] at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:29)
[MIUIScout App] at android.os.Handler.handleCallback(Handler.java:958)
[MIUIScout App] at android.os.Handler.dispatchMessage(Handler.java:99)
[MIUIScout App] at android.os.Looper.loopOnce(Looper.java:222)
[MIUIScout App] at android.os.Looper.loop(Looper.java:314)
[MIUIScout App] at android.app.ActivityThread.main(ActivityThread.java:8680)
[MIUIScout App] at java.lang.reflect.Method.invoke(Native Method)
[MIUIScout App] at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:565)
[MIUIScout App] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
[MIUIScout ANR] get period history msg: (Current message: duration=5801ms seq=3776 late=12ms h=android.os.Handler c=mono.java.lang.RunnableImplementor)
[MIUIScout ANR] get period history msg:messages for the same target android.view.Choreographer$FrameHandler execute time>50ms (count=181 totalwalltime=1052ms h=android.view.Choreographer$FrameHandler

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

3 participants