ThinkGeo.com    |     Documentation    |     Premium Support

PanZoomTool Error

Hello,

I’m working on a project that displays the PanZoomTool on a map. Zooming and panning works fine, but when I click the dot in the center I receive an error: ‘Object reference not set to an instance of an object.’

I was just wondering what I’m missing thatt needs to be set (or handled) to resolve this?

Currently using Version 13.1.0.

Thanks,

Aaron

Hi Aaron,

Do you have more details on the exception? Or a stack trace?

I just tested with 13.1.0 on our ‘HowDoI’ samples and the dot in the center is working as expected and is not throwing an error.

There must be something specific in your data or code that is unexpected. If you’re able to attach a simple .sln file that recreates the issue, that would be best. But if not at least a stack trace may help some.

Thanks,
John

I was confused as well as the button did work in the HowDoI samples I downloaded.

Here’s some additional info, though it may not be that helpful.

System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=ThinkGeo.Core
StackTrace:
at EhU=.ixw=.kBw=(Byte[] wkb)

> ThinkGeo.Core.dll!EhU=.ixw=.kBw=(byte[] wkb) Unknown
ThinkGeo.Core.dll!ThinkGeo.Core.Feature.GetBoundingBoxCore() Unknown
ThinkGeo.Core.dll!ThinkGeo.Core.Feature.GetBoundingBox() Unknown
ThinkGeo.Core.dll!ThinkGeo.Core.FeatureSource.GetBoundingBoxCore() Unknown
ThinkGeo.Core.dll!ThinkGeo.Core.FeatureSource.GetBoundingBox() Unknown
ThinkGeo.Core.dll!ThinkGeo.Core.FeatureLayer.GetBoundingBoxCore() Unknown
ThinkGeo.Core.dll!ThinkGeo.Core.Layer.GetBoundingBox() Unknown
ThinkGeo.UI.Wpf.dll!ThinkGeo.Core.LayerOverlay.GetBoundingBoxCore() Unknown
ThinkGeo.UI.Wpf.dll!ThinkGeo.Core.Overlay.GetBoundingBox() Unknown
ThinkGeo.UI.Wpf.dll!ThinkGeo.Core.PanZoomBarMapTool.M0Q=(object sender, System.Windows.Input.MouseButtonEventArgs e) Unknown
PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target) Unknown
PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source, System.Windows.RoutedEventArgs args, bool reRaised) Unknown
PresentationCore.dll!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender, System.Windows.RoutedEventArgs args) Unknown
PresentationCore.dll!System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs args) Unknown
PresentationCore.dll!System.Windows.Input.InputManager.ProcessStagingArea() Unknown
PresentationCore.dll!System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport inputReport) Unknown
PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.ReportInput(nint hwnd, System.Windows.Input.InputMode mode, int timestamp, System.Windows.Input.RawMouseActions actions, int x, int y, int wheel) Unknown
PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.FilterMessage(nint hwnd, MS.Internal.Interop.WindowMessage msg, nint wParam, nint lParam, ref bool handled) Unknown
PresentationCore.dll!System.Windows.Interop.HwndSource.InputFilterMessage(nint hwnd, int msg, nint wParam, nint lParam, ref bool handled) Unknown
WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(nint hwnd, int msg, nint wParam, nint lParam, ref bool handled) Unknown
WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) Unknown
WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) Unknown
WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(nint hwnd, int msg, nint wParam, nint lParam) Unknown
[Native to Managed Transition]
[Managed to Native Transition]
WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame) Unknown
PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore) Unknown
PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) Unknown
MyApp.dll!MyApp.App.Main() Unknown

I’ll see if I can’t pull together a small project that has the same error.

To add a bit more, I have a LayerOverlay that has several layers.
These layers are made up of InMemoryFeatureLayers.

To start, each InMemoryFeatureLayer has once feature added to it, made up of a point at 0, 0.

If I add this overlay layer to the map, the (what I assume is) zoom to full extent option does not work.
If I don’t add it, it does.

I just figured it out.
One of the InMemoryFeatureLayers that I was adding had a number of empty features in it.
once I made sure to check for this and remove them the error stopped occurring.

Hi Aaron,

That’s good news! I’m glad the issue is resolved.

I will go ahead and talk to the product team to see if we want to find a better way to improve the exception in your scenario.

Thanks,
John