Mapsui: [Forms][beta-28/30/master] OnPaintSurface NullReferenceException

Hello, not sure if Mapsui or SkiaSharp problem, but I’m facing this after updating Mapsui from beta-22 to beta-28/30 or even after downloading source from master and referencing this in my project.

Affected with Xamarin Forms 4.3 Mapsui beta-28/beta-30/master

Reproduction project The same behavior appears in my main project, so I created simple project to show this. Displaying map is exactly the same as I have in my project (I mean this ContentView, etc.) https://github.com/jabools/mapsui-exception

Reproduction steps

  1. Go to Map from side menu
  2. Go back to About
  3. Go to Map again, and it will crash

Stacktrace

11-27 18:54:44.469 E/mono    (29129): Unhandled Exception:
11-27 18:54:44.469 E/mono    (29129): System.NullReferenceException: Object reference not set to an instance of an object.
11-27 18:54:44.469 E/mono    (29129):   at SkiaSharp.Views.Android.SKGLTextureViewRenderer.get_CanvasSize () [0x00000] in <c472e4808aa44f04aff13ad4b12cbbac>:0 
11-27 18:54:44.469 E/mono    (29129):   at SkiaSharp.Views.Android.SKGLTextureView.get_CanvasSize () [0x00000] in <c472e4808aa44f04aff13ad4b12cbbac>:0 
11-27 18:54:44.469 E/mono    (29129):   at SkiaSharp.Views.Forms.SKGLViewRendererBase`2[TFormsView,TNativeView].OnGetCanvasSize (System.Object sender, SkiaSharp.Views.Forms.GetPropertyValueEventArgs`1[T] e) [0x00007] in <744e5c462db84bf7969e9620360e34f4>:0 
11-27 18:54:44.469 E/mono    (29129):   at (wrapper delegate-invoke) System.EventHandler`1[SkiaSharp.Views.Forms.GetPropertyValueEventArgs`1[SkiaSharp.SKSize]].invoke_void_object_TEventArgs(object,SkiaSharp.Views.Forms.GetPropertyValueEventArgs`1<SkiaSharp.SKSize>)
11-27 18:54:44.469 E/mono    (29129):   at SkiaSharp.Views.Forms.SKGLView.get_CanvasSize () [0x00010] in <744e5c462db84bf7969e9620360e34f4>:0 
11-27 18:54:44.469 E/mono    (29129):   at Mapsui.UI.Forms.MapControl.OnPaintSurface (System.Object sender, SkiaSharp.Views.Forms.SKPaintGLSurfaceEventArgs skPaintSurfaceEventArgs) [0x00000] in <628579b00c104b96ab9d59182f6ee335>:0 
11-27 18:54:44.469 E/mono    (29129):   at SkiaSharp.Views.Forms.SKGLView.OnPaintSurface (SkiaSharp.Views.Forms.SKPaintGLSurfaceEventArgs e) [0x0000a] in <744e5c462db84bf7969e9620360e34f4>:0 
11-27 18:54:44.469 E/mono    (29129):   at SkiaSharp.Views.Forms.SKGLView.SkiaSharp.Views.Forms.ISKGLViewController.OnPaintSurface (SkiaSharp.Views.Forms.SKPaintGLSurfaceEventArgs e) [0x00000] in <744e5c462db84bf7969e9620360e34f4>:0 
11-27 18:54:44.469 E/mono    (29129):   at SkiaSharp.Views.Forms.SKGLViewRendererBase`2[TFormsView,TNativeView].OnPaintSurface (System.Object sender, SkiaSharp.Views.Android.SKPaintGLSurfaceEventArgs e) [0x00021] in <744e5c462db84bf7969e9620360e34f4>:0 
11-27 18:54:44.469 E/mono    (29129):   at SkiaSharp.Views.Android.SKGLTextureView.OnPaintSurface (SkiaSharp.Views.Android.SKPaintGLSurfaceEventArgs e) [0x0000a] in <c472e4808aa44f04aff13ad4b12cbbac>:0 
11-27 18:54:44.469 E/mono    (29129):   at SkiaSharp.Views.Android.SKGLTextureView+InternalRenderer.OnPaintSurface (SkiaSharp.Views.Android.SKPaintGLSurfaceEventArgs e) [0x00000] in <c472e4808aa44f04aff13ad4b12cbbac>:0 
11-27 18:54:44.469 E/mono    (29129):   at SkiaSharp.Views.Android.SKGLTextureViewRenderer.OnDrawFrame (Javax.Microedition.Khronos.Opengles.IGL10 gl) [0x00116] in <c472e4808aa44f04aff13ad4b12cbbac>:0 
11-27 18:54:44.469 E/mono    (29129):   at SkiaSharp.Views.Android.GLTextureView+GLThread.GuardedRun () [0x003b5] in <c472e4808aa44f04aff13ad4b12cbbac>:0 
11-27 18:54:44.469 E/mono    (29129):   at SkiaSharp.Views.Android.GLTextureView+GLThread.Run () [0x00025] in <c472e4808aa44f04aff13ad4b12cbbac>:0 
11-27 18:54:44.469 E/mono    (29129):   at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in <3a61d48d66dd458fa0b64990b6c8f8cc>:0 
11-27 18:54:44.469 E/mono    (29129):   at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <3a61d48d66dd458fa0b64990b6c8f8cc>:0 
11-27 18:54:44.469 E/mono    (29129):   at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <3a61d48d66dd458fa0b64990b6c8f8cc>:0 
11-27 18:54:44.469 E/mono    (29129):   at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in <3a61d48d66dd458fa0b64990b6c8f8cc>:0 
11-27 18:54:44.469 E/mono    (29129):   at System.Threading.ThreadHelper.ThreadStart () [0x00008] in <3a61d48d66dd458fa0b64990b6c8f8cc>:0 

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (13 by maintainers)

Most upvoted comments

Since @jabools reports his problem is fixed I will close this issue.

You are awesome @mattleibow!

This afternoon 2.0.0-beta.32 was released with skiasharp 1.68.2-preview.17.

Great job, now it works like a charm ^_^ thanks a lot!

I just pushed out a preview (1.68.2-preview.17) to the preview feed so you can try it out now. I just want to do a few more checks and then it will go to nuget.org.

The preview feed is https://nugetized.blob.core.windows.net/skiasharp-eap/index.json

I will see what I can do to get a release out sooner for you folks. I’m queuing up a build for a preview release. As soon as that is out, you can have a test and see if everything is fixed.