ThinkGeo.com    |     Documentation    |     Premium Support

Unhandled SkiaSharp exception

Hi ThinkGeo!

We’ve taken the ThinkGeo.UI.Wpf 13.2.1 into use and so far it has looked to fix previous problems and the async operations solve some performance issues.

However we’ve now seen quite a random error happening on our robot tests every now and then and it has also occurred at least once in the production environment. We are not yet able to reproduce it repeatably but here are the details in case you happen to find your way to the root cause anyway.

Description: The process was terminated due to an unhandled exception.
Exception Info: System.Runtime.InteropServices.SEHException
   at SkiaSharp.SKImage.FromPixels(SkiaSharp.SKPixmap, SkiaSharp.SKImageRasterReleaseDelegate, System.Object)
   at 6hQ=.Nks=.N0s=(ThinkGeo.Core.GeoImage)
   at ThinkGeo.Core.TileView+<>c__DisplayClass98_0.<CommitDrawingAsyncCore>b__0()
   at System.Windows.Threading.DispatcherOperation.InvokeDelegateCore()
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
   at System.Windows.Application.RunDispatcher(System.Object)
   at System.Windows.Application.RunInternal(System.Windows.Window)
   at App.Main()

Versions:
ThinkGeo.UI.Wpf 13.2.1
ThinkGeo.Gdal 13.2.0
ThinkGeo.GeoPdf 13.2.0
ThinkGeo.Kml 13.2.0
ThinkGeo.UnmanagedGeoTiff 13.2.0
ThinkGeo.UnmanagedProj 13.2.0

Best Regards,
Jarno

Hi Jarno,

I’m glad the newer builds and async changes are working well for you. I’ve searched our archives and I have not found this exception reported in the past. But I’ll bring this up with the product team and get their advice and see if they have any clues based on the stack trace.

In the mean-time, if you find a way to reproduce the error, please let us know.

Thanks,
John

1 Like

Hi Jarno,

I made some improvements in the latest beta (ThinkGeo.UI.Wpf 13.3.0-beta019), please update to that version and have another try.

The exception happens when converting a GeoImage(internally it’s a SkiaImage) to a WPF WriteableBitmap. What I did is moving it from the UI thread to the same thread in which the GeoImage is rendered, this could fix the issue.

If you still see the exception, or the map is not render correctly, please use the following code to expose the internal exception, and let us know.

overlay.DrawingExceptionMode = drawingExceptionMode;
overlay.ThrowingException += (sender, e) =>
{
throw e.Exception;
};

Thanks,
Ben