ThinkGeo.com    |     Documentation    |     Premium Support

"A task was canceled" exceptions for point layers

Hi, I’ve been getting a lot of “A task was canceled” exceptions recently related to the tile cache.

They happen when turning the visible to invisible & back before it is finished rendering.
This is quite a big performance hit for Point based layers because the Exception is thrown for every single cancelled point. So having a layer with 50 points will throw an exception 50 times.
Is there any way we can improve this? Optimally it should throw 1 exception for the layer.

[System.Threading.Tasks.TaskCanceledException thrown]	
System.Private.CoreLib.dll!System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()	Unknown
System.Private.CoreLib.dll!System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task, System.Threading.Tasks.ConfigureAwaitOptions options)	Unknown
ThinkGeo.Core.dll!ThinkGeo.Core.TileCache.9UA=.MoveNext()	Unknown
ThinkGeo.UI.Wpf.dll!ThinkGeo.UI.Wpf.TileOverlay.OEk=.MoveNext()	Unknown

Julian, can you show me a code snippet to recreate this issue?

Hi Ben, I created a repro project, please let me know what email I can send it to as it cannot be publicly shared.
Also, I narrowed down the possible issue, it is actually triggered when zooming twice before the first zoom was completed, and the tilecache canceling the tile saving. This already happens with an empty map with a filerastertilecache, it just gets more intense with a layer in.

private void MapView_Loaded(object sender, RoutedEventArgs e)
{
    MapView.MapUnit = GeographyUnit.Meter;

    var layerOverlay = new LayerOverlay
    {
        DrawingQuality = DrawingQuality.HighSpeed,
        TileType = TileType.MultiTile,
        TileCache = new FileRasterTileCache("./", "Test"),
        TileBuffer = 1
    };
    MapView.Overlays.Add(layerOverlay);
    _= MapView.RefreshAsync();
}

and enable all exceptions thrown.

Latest beta (14.5.0 beta65)

Please send to support@thinkgeo.com, I’m sure we can improve it.