Skip to content

[iOS, 3.0 Preview 3.1] SkiaSharp's memory becomes corrupted and it stops to function in .NET 9.0 Preview 6 #2840

@janne-hmp

Description

@janne-hmp

Description

My game GnollHack has several SKCanvasViews (and a few SKGLViews), and they all work well in SkiaSharp 2.88.8 (Xamarin). However, on iOS in SkiaSharp 3.0 Preview 3.1 with .NET MAUI 9.0 Preview 6, SkiaSharp's memory gets corrupted, and it stops drawing the canvases or draws a black canvas only after showing and hiding various layouts / grids many times.

The problem seems to be with just SKCanvasViews, but the problem emerges more quickly if both SKCanvasViews and SKGLViews are present on the page.

Code

https://github.com/hyvanmielenpelit/GnollHack

Expected Behavior

Game and SKCanvasView work as in Xamarin 2.88.8 on iOS without corrupting the memory.

Actual Behavior

After opening many pages and showing and hiding layouts / grids, SkiaSharp's memory gets corrupted and it stops drawing on iOS. It is enough to press Play Game and then Cancel many times. If you do this with SKGLViews activated, 1-3 Play Game presses corrupts the memory; with only SKCanvasViews, 4-10 presses are needed. (Pressing Play Game opens a modal GamePage on the top of MainPage, and then on GamePage the MenuGrid covering the whole page on the top of main canvasView element. There are lots of SKCanvasViews everywhere.)

Version of SkiaSharp

3.x (Alpha)

Last Known Good Version of SkiaSharp

2.88.8 in Xamarin (Android works, too)

IDE / Editor

Visual Studio (Windows)

Platform / Operating System

iOS

Platform / Operating System Version

iOS 17.5.1

Devices

iPad 11,7

Relevant Screenshots

No response

Relevant Log Output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions