ThinkGeo.com    |     Documentation    |     Premium Support

Random SkiaSharp exception

Hi,

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…

Br, Simo

Hi Simo,

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.

  1. Can you locate which overlay which causes this issue, and disable TileOverlay.TileCache temporarily see if it still exists?
  2. what tilecache you are using? Just a standard FileTileCache or a custom one?

And here are something you can do on your side:

  1. Update to the latest version. we’ve made many internal stability improvements that may help, here you can see the change log:
    https://docs.thinkgeo.com/products/desktop-maps/changelog/#major-changes-for-thinkgeo-1432

  2. Enable internal logging to capture any underlying issues

ThinkGeoDebugger.LogType = ThinkGeoLogType.Rendering | ThinkGeoLogType.Caching | ThinkGeoLogType.Rendering;
ThinkGeoDebugger.LogLevel = ThinkGeoLogLevel.All;

Thanks,
Ben

Hi,

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.

Br, Simo

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.

Hi,

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 ?

Br, Simo

I was trying to give you a workaround in the first place based on your current version but failed.

Based on the latest stable version v14.4.2, we can create a hotfix v14.4.3 with this fix.

Hi,

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.

Br, Simo

Hi Simo,

You might want to upgrade to v14.4.2 first, and make sure it works fine with your project. Every issue in v14.4.2 will also exist in v14.4.3.

Thanks,
Ben

Hi,

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.

Br, Simo

OK. We will do it early next year. Let me know if you find any other issues and we’ll see if we can put them to 14.4.3 as well.

Hi Simo,

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.

Your other request is included in v14.4.3: OgcApiFeatureLayer and LayerOverlay - ThinkGeo UI for Desktop / WPF - ThinkGeo Discussion Forums

Thanks,
Ben

Hi,

OK, thanks for the info.

Br, Simo