After upgraded our application to ThinkGeo 14.3.2 I am observing the cancellation exception as mentioned before. In some cases, the UI is not updated correctly when the cancellation operation is thrown.
For example, in our application the user can press the zoom buttons indicated by the red arrow.
In some cases when the exception is thrown then the UI panting operation seems to be stopped.
In the following log the line containing “Zoom the map to the selected Scale” is written just before the ZoomToAsync is called. From the timestamp in the log there is a time difference between the 2 calls of about 1 second (the user press 2 times on the button).
I 2025-08-15 13:52:33.276Z Damm.MapCtrl.WPF.View: Zoom the map to the selected Scale [Requested Scale: 7500][Corrected Scale: 7500][Current Extent: 9.794884334932853,54.920608499413156,9.817885628262747,54.90964359715807][Current Center: 9.8063849815978,54.915126048285615,0][Reason: ViewModel.RequestChangeCurrentScale]
I 2025-08-15 13:52:34.195Z Damm.MapCtrl.WPF.View: Zoom the map to the selected Scale [Requested Scale: 10000][Corrected Scale: 10000][Current Extent: 9.789134011600398,54.92334972497692,9.823635951595202,54.906902371594306][Current Center: 9.8063849815978,54.915126048285615,0][Reason: ViewModel.RequestChangeCurrentScale]
Exception thrown: 'System.Threading.Tasks.TaskCanceledException' in System.Private.CoreLib.dll
W 2025-08-15 13:52:34.462Z Damm.MapCtrl.WPF.View: Error setting the Scale [Scale: 10000][Reason: ViewModel.RequestChangeCurrentScale]
EXCEPTION: A task was canceled.
at ThinkGeo.UI.Wpf.MapViewBase.REQ=(PointShape fromCenter, PointShape toCenter, Double fromResolution, Double toResolution, Double fromAngle, Double toAngle, UInt32 animationLength, EasingFunctionBase easing, Boolean fromMouseInteraction, CancellationToken cancellationToken)
at ThinkGeo.UI.Wpf.MapViewBase.cEQ=(PointShape targetCenter, Double targetScale, Double rotationAngle, MapAnimationSettings animationSettings, CancellationToken cancellationToken, Boolean fromMouseInteraction)
at ThinkGeo.UI.Wpf.MapViewBase.ZoomToAsync(Double targetScale, CancellationToken cancellationToken)
at Damm.MapCtrl.WPF.MapView.SetScaleAsync(Double _scale, Boolean _isInitialScale, Boolean _doCorrectScale, String _reason, PointShape _centerAt, CancellationToken _cancellation) in D:\Repos\Releases\Ver08_12\Damm\DammMapCtrl.WPF\MapView.xaml.cs:line 4843
END EXCEPTION --------------------------------------------------------------------
Code:
DammLogger.Log(DammLoggerLevel.Info, TAG,
"Zoom the map to the selected Scale " +
“[Requested Scale: {0}]” +
“[Corrected Scale: {1}]” +
“[Current Extent: {2}][Current Center: {3}]” +
“[Reason: {4}]”,
_scale, correctedScale,
currenExtent, currenExtent.GetCenterPoint(),
_reason
);
await Map.ZoomToAsync(correctedScale, _cancellation);
Do you have any suggestion about how we can avoid the bad refreshing in the UI ?
Best regards
Domenico