ThinkGeo.com    |     Documentation    |     Premium Support

RefreshAsync fails in beta059

Hi,

we’re using ThinkGeo for a long time.

But when I now update from beta57 to beta59 (and probably later) we’re getting an error when refreshing the map. We’re a bit helpless as we did not change anything and do not provide a parameter.

 ---> System.ArgumentNullException: The parameter you supplied may not be null. (Parameter 'worldExtent')
   at ThinkGeo.Core.ValidatorHelper.CheckObjectIsNotNull(Object parameterObject, String parameterName)
   at ThinkGeo.Core.MapUtil.GetScale(GeographyUnit mapUnit, RectangleShape boundingBox, Double widthInPixel, Double heightInPixel, Single dpi)
   at ThinkGeo.Core.MapUtil.kh0=(RectangleShape targetExtent, Double actualWidth, Double actualHeight, Double maximumScale, Double minimumScale, GeographyUnit mapUnit)
   at ThinkGeo.Core.MapUtil.AdjustExtentByRestrictions(RectangleShape targetExtent, Double width, Double height, RectangleShape restrictExtent, Double maximumScale, Double minimumScale, GeographyUnit mapUnit)
   at ThinkGeo.Core.MapViewBase.DrawAsyncCore(RectangleShape targetExtent, OverlayRefreshType overlayRefreshType, CancellationToken cancellationToken)
   at ThinkGeo.Core.MapViewBase.DrawAsync(RectangleShape targetExtent, OverlayRefreshType refreshType, CancellationToken cancellationToken)
   at ThinkGeo.Core.MapViewBase.RefreshAsync(RectangleShape extent, OverlayRefreshType refreshType, CancellationToken cancellationToken)
   at ThinkGeo.Core.MapViewBase.RefreshAsync(OverlayRefreshType refreshType, CancellationToken cancellationToken)

Could you please check what kind of change in beta059 leads to this and how we can mitigate the cause? Thank you!

Regards,
Peter

After updating to beta104 the error has now changed to:

---> System.NullReferenceException: Object reference not set to an instance of an object.
   at ThinkGeo.Core.MapUtil.GetScale(RectangleShape worldExtent, Double screenWidth, GeographyUnit worldExtentUnit, Single dpi)
   at ThinkGeo.Core.MapUtil.GetScale(GeographyUnit mapUnit, RectangleShape boundingBox, Double widthInPixel, Double heightInPixel, Single dpi)
   at ThinkGeo.Core.MapUtil.kx0=(RectangleShape targetExtent, Double actualWidth, Double actualHeight, Double maximumScale, Double minimumScale, GeographyUnit mapUnit)
   at ThinkGeo.Core.MapUtil.AdjustExtentByRestrictions(RectangleShape targetExtent, Double width, Double height, RectangleShape restrictExtent, Double maximumScale, Double minimumScale, GeographyUnit mapUnit)
   at ThinkGeo.UI.Wpf.MapViewBase.DrawAsyncCore(RectangleShape targetExtent, OverlayRefreshType overlayRefreshType, CancellationToken cancellationToken)
   at ThinkGeo.UI.Wpf.MapViewBase.DrawAsync(RectangleShape targetExtent, OverlayRefreshType refreshType, CancellationToken cancellationToken)
   at ThinkGeo.UI.Wpf.MapViewBase.RefreshAsync(RectangleShape extent, OverlayRefreshType refreshType, CancellationToken cancellationToken)
   at ThinkGeo.UI.Wpf.MapViewBase.RefreshAsync(OverlayRefreshType refreshType, CancellationToken cancellationToken)

But I think it is still caused by the same issue as the world extent seems to be involved.

Any help is greatly appreciated. Thank you.

Hi Peter,

I think that’s because the mapView.CurrentExtent is not set (and be null by default). In the latest beta we stopped setting the default extent to the entire world and require the users to set the CurrentExtent (You can also set the CenterPoint and CurrentScale) in the application. Please review your application see if that’s the case.

At the same time let us review it and see if it’s a good way to go. At least we need some better exception messages.

Thanks,
Ben

Hi Peter,

We’ve added parameter checking into all MapView RefreshAsync methods and you will see better exceptions in the next release.

Thanks,
Ben

Hi Ben,

I’ve got it to work for the moment. Thank you for your help!

Regarding setting the CurrentMapExtent I’ve to say that it is a bit inconvenient that you now have to set two values instead of just one.

Regards,
Peter

Hi Peter,

We were thinking of using CenterPoint and Scale mainly because CurrentExtent would be confusing if the map is rotated since the extent is not a rectangle anymore, Also, it would be easier to figure out the center/scale of a new spot than the extent.

Let us think over it and see if we remove the obsolete warning and let user be able to use both CurrentExtent and CenterPoint/Scale.

Thanks,
Ben