Hello,
I have a mapping application that I’ve been working on and currently I am experiencing an issue with task cancellation exceptions when refreshing a layer, or attempting to center the map on a feature.
For example, I have the following method
private async Task ZoomToTugAsync() {
if (_mapView is null)
return;
if (_tugLayer.InternalFeatures.Contains("MyShape")) {
await _mapView.CenterAtAsync(_layer.InternalFeatures["MyShape"]);
}
else {
MessageBox.Show(
messageBoxText: "There is no position available for MyShape",
caption: "Error",
button: MessageBoxButton.OK,
icon: MessageBoxImage.Exclamation);
}
}
I get the following error, which in this case crashed the program
System.ArgumentException: Destination array was not long enough. Check the destination index, length, and the array’s lower bounds. (Parameter ‘destinationArray’)
at ThinkGeo.UI.Wpf.TileOverlay.3EU=(RectangleShape drawingExtent, Int32 zoom, Double matrixScale, Double currentScale, Collection1 cells, OverlayRefreshType overlayRefreshType, TileType tileType, Boolean withPosting, Boolean drawingBuffer, CancellationToken cancellationToken) at ThinkGeo.UI.Wpf.TileOverlay.3UU=(RectangleShape drawingExtent, OverlayRefreshType overlayRefreshType, Boolean renderToCanvas, CancellationToken cancellationToken) at ThinkGeo.UI.Wpf.TileOverlay.DrawAsyncCore(RectangleShape targetExtent, OverlayRefreshType overlayRefreshType, CancellationToken cancellationToken) at ThinkGeo.UI.Wpf.LayerOverlay.DrawAsyncCore(RectangleShape targetExtent, OverlayRefreshType overlayRefreshType, CancellationToken cancellationToken) at ThinkGeo.UI.Wpf.Overlay.DrawAsync(RectangleShape targetExtent, OverlayRefreshType refreshType, CancellationToken cancellationToken) at ThinkGeo.UI.Wpf.Overlay.wkU=(Exception e, String memberName) at ThinkGeo.UI.Wpf.Overlay.DrawAsync(RectangleShape targetExtent, OverlayRefreshType refreshType, CancellationToken cancellationToken) at ThinkGeo.UI.Wpf.MapViewBase.LkU=(Overlay overlay, RectangleShape targetExtent, OverlayRefreshType refreshType, Boolean renderToCanvas, CancellationToken cancellationToken) at ThinkGeo.UI.Wpf.MapViewBase.KEU=(IEnumerable1 overlays, RectangleShape targetExtent, OverlayRefreshType refreshType, Boolean renderToCanvas, CancellationToken cancellationToken)
at ThinkGeo.UI.Wpf.MapViewBase.GkU=(PointShape targetCenter, Double targetScale, Double rotationAngle, MapAnimationSettings animationSettings, CancellationToken cancellationToken, Boolean fromMouseInteraction)
at ThinkGeo.UI.Wpf.MapViewBase.GkU=(RectangleShape targetExtent, Double rotationAngle, MapAnimationSettings animationSettings, CancellationToken cancellationToken)
at ThinkGeo.UI.Wpf.MapViewBase.CenterAtAsync(PointShape worldPoint, CancellationToken cancellationToken)
at ThinkGeo.UI.Wpf.MapViewBase.CenterAtAsync(Feature centerFeature, CancellationToken cancellationToken)
at ADISSPlayApp.Mapping.MapController.ZoomToTugAsync() in D:\ADISS\Repos\ADISS Applications\ADISSPlay\ADISSPlayApp\UI\Mapping\MapController.cs:line 645
In another case, the following code block produced a similar error.
await _mapView.Dispatcher.InvokeAsync(async () => {
await _vesselsOverlay.RefreshAsync();
});
System.AggregateException: A Task’s exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. (Destination array was not long enough. Check the destination index, length, and the array’s lower bounds. (Parameter ‘destinationArray’))
—> System.ArgumentException: Destination array was not long enough. Check the destination index, length, and the array’s lower bounds. (Parameter ‘destinationArray’)
at ThinkGeo.UI.Wpf.TileOverlay.3EU=(RectangleShape drawingExtent, Int32 zoom, Double matrixScale, Double currentScale, Collection`1 cells, OverlayRefreshType overlayRefreshType, TileType tileType, Boolean withPosting, Boolean drawingBuffer, CancellationToken cancellationToken)
at ThinkGeo.UI.Wpf.TileOverlay.3UU=(RectangleShape drawingExtent, OverlayRefreshType overlayRefreshType, Boolean renderToCanvas, CancellationToken cancellationToken)
at ThinkGeo.UI.Wpf.TileOverlay.DrawAsyncCore(RectangleShape targetExtent, OverlayRefreshType overlayRefreshType, CancellationToken cancellationToken)
at ThinkGeo.UI.Wpf.LayerOverlay.DrawAsyncCore(RectangleShape targetExtent, OverlayRefreshType overlayRefreshType, CancellationToken cancellationToken)
at ThinkGeo.UI.Wpf.Overlay.DrawAsync(RectangleShape targetExtent, OverlayRefreshType refreshType, CancellationToken cancellationToken)
at ThinkGeo.UI.Wpf.Overlay.wkU=(Exception e, String memberName)
at ThinkGeo.UI.Wpf.Overlay.DrawAsync(RectangleShape targetExtent, OverlayRefreshType refreshType, CancellationToken cancellationToken)
at ThinkGeo.UI.Wpf.Overlay.RefreshAsyncCore(CancellationToken cancellationToken)
at ThinkGeo.UI.Wpf.Overlay.RefreshAsync(CancellationToken cancellationToken)
at ADISSPlayApp.Mapping.MapController.b__83_0() in D:\ADISS\Repos\ADISS Applications\ADISSPlay\ADISSPlayApp\UI\Mapping\MapController.cs:line 989
I am currently running version 14.4.4 for both ThinkGeo.Core and ThinkGeo.UI.Wpf
Thanks in advance.