We are currently using ThinkGeo version 14.3.1. We are still seeing random SkiaSharp exception on our automation similar to one which Jarno decribed in this old post A random SkiaSharp related unhandled exception
Actual exception is most of the time SEHException but also AccessViolationException is seen:
Exception Info: System.Runtime.InteropServices.SEHException
at SkiaSharp.SKImage.FromPixels(SkiaSharp.SKPixmap, SkiaSharp.SKImageRasterReleaseDelegate, System.Object)
at bkY=.9UU=.9kU=(ThinkGeo.Core.GeoImage)
at ThinkGeo.UI.Wpf.TileView.20U=(ThinkGeo.Core.GeoCanvas)
at ThinkGeo.UI.Wpf.TileOverlay+d__106.MoveNext()
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.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
Exception Info: System.AccessViolationException
at SkiaSharp.SKImage.FromPixels(SkiaSharp.SKPixmap, SkiaSharp.SKImageRasterReleaseDelegate, System.Object)
at bkY=.9UU=.9kU=(ThinkGeo.Core.GeoImage)
at ThinkGeo.UI.Wpf.TileView.20U=(ThinkGeo.Core.GeoCanvas)
at ThinkGeo.UI.Wpf.TileOverlay+d__106.MoveNext()
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.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
Do you have any idea what could cause that kind of issue ? Problem is that we cannot re-produce easily since it happens so randomly on automation…
It seems this exception happens when converting a GeoImage to WriteableBitmap for display. It’s most likely be related to the tilecache, could because of a corrupted tile or a race condition under multi-threading.
Can you locate which overlay which causes this issue, and disable TileOverlay.TileCache temporarily see if it still exists?
what tilecache you are using? Just a standard FileTileCache or a custom one?
Problem with this exception is that it occurs like once in a month or two in our automation which runs lots of tests daily. So disabling cache temporarily would mean that we would need to disable it for months to see if it helps and that cannot be done. Same problem is with the enabling internal logging.
On our basic test setup we have two LayerOverlay’s both using FileRasterTileCache as tilecache. We also have ThrowingExceptionMode set to ThrowingExceptionMode.SuppressException on our overlays but still we get this crash.
This issue is fully resolved in the latest beta (052). It only occurred in rare race conditions, and we’ve fixed it at the core level, it shouldn’t happen again.
Great that you managed to fix the issue. Since your next release is going to be on May is there any change to get this fix included to earlier release by somekind of workaround ?
It would be great if you could create a hotfix with 14.4.3. We are plannig to update our ThinkGeo version after new year so with the hotfix we could get this included as well.
Yes, naturally we need to make sure that all other changes between our current version and 14.4.3 are working fine on our application while doing the upgrade.
We just released v14.4.3, but we didn’t include this change. During testing, we found it could make the peak memory too high. We have an idea to fix both the memory and AccessViolationException, we’ll do it in the beta branch, run more testing, and then bring it into a future stable release once it’s ready. At latest you can have it in v14.5.
This kind of SkiaSharp exception was seen with v14.4.4:
System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.
at SkiaSharp.SKImage.FromBitmap(SKBitmap bitmap)
at SkiaSharp.SKCanvas.DrawBitmap(SKBitmap bitmap SKRect dest SKPaint paint)
at 9hQ=.RRU=.WBU=(GeoImage image Single x Single y Single width Single height Single canvasWidth Single canvasHeight)
at 9hQ=.RRU=.WRU=(GeoImage image Int32 x Int32 y Single canvasWidth Single canvasHeight)
at ThinkGeo.Core.SkiaGeoCanvas.FlushCore()
at ThinkGeo.Core.SkiaGeoCanvas.EndDrawingCore()
at ThinkGeo.UI.Wpf.AdornmentOverlay.<DrawAsyncCore>d__8.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at ThinkGeo.UI.Wpf.Overlay.<DrawAsync>d__65.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at ThinkGeo.UI.Wpf.Overlay.x0U=(Exception e String memberName)
at ThinkGeo.UI.Wpf.Overlay.<DrawAsync>d__65.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at ThinkGeo.UI.Wpf.MapViewBase.<DrawOverlayAsync>d__357.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at ThinkGeo.UI.Wpf.MapViewBase.<DrawOverlaysAsync>d__351.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at ThinkGeo.UI.Wpf.MapViewBase.<ZoomToAsync2>d__288.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at ThinkGeo.UI.Wpf.MapViewBase.<ZoomToAsync>d__312.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
So far this has happened only once and did not happen again when we tried to re-produce it.