Skip to content

[BUG] NullReferenceException occurs when iOS redraws SKCanvasView view but it had been already disposed #960

Closed

Description

@dmitryzarubin

Description

Exception has occurred in the moment of back navigation from page with SKCanvasView.

System.NullReferenceException: Object reference not set to an instance of an object
at SkiaSharp.Views.iOS.SKDrawable.DrawSurface (CoreGraphics.CGContext ctx, CoreGraphics.CGRect viewBounds, SkiaSharp.SKImageInfo info, SkiaSharp.SKSurface surface) <0x104f466f0 + 0x0004c> in <1dff7dabaada4d38b0d12baee26f046c#85a406ab9d3ebec0a9a84dd9b6d8be21>:0 
at SkiaSharp.Views.iOS.SKCanvasView.Draw (CoreGraphics.CGRect rect) <0x104f42990 + 0x002bb> in <1dff7dabaada4d38b0d12baee26f046c#85a406ab9d3ebec0a9a84dd9b6d8be21>:0 
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) <0x10434de20 + 0x0002b> in <854c6713acc54b0389a597c8b4079500#85a406ab9d3ebec0a9a84dd9b6d8be21>:0 
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) <0x10434dd60 + 0x000ab> in <854c6713acc54b0389a597c8b4079500#85a406ab9d3ebec0a9a84dd9b6d8be21>:0 
at SomeApp.AppDelegate.Main (System.String[] args) <0x102769e20 + 0x0003f> in :0

Root cause
Using of disposed object.
https://github.com/mono/SkiaSharp/blob/master/source/SkiaSharp.Views/SkiaSharp.Views.AppleiOS/SKCanvasView.cs

Screenshot_1

Basic Information

  • Version with issue: 1.68.0
  • IDE: Visual Studio
  • Platform Target Frameworks: Xamarin.Touch
    • iOS: 12.2

Activity

  1. added a commit that references this issue on Apr 28, 2020
    5a7d9db
  2. mattleibow commented on Apr 28, 2020

    @mattleibow
    Contributor

    Thanks for this issue. I know it has been a long time, but strange that iOS was drawing a disposed view - and also strange that not everyone was getting this.

  3. added a commit that references this issue on Apr 28, 2020
    221a96b
  4. added this to the v1.68.2 milestone on Apr 29, 2020
  5. ghost locked as resolved and limited conversation to collaborators on Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions