This is a migrated thread and some comments may be shown as answers.

NullReferenceException within Telerik.Windows.Controls.Map.MapCanvas.MeasureOverride

2 Answers 127 Views
Map
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 17 Feb 2020, 12:56 PM

We're generating a busy and complicated map with a lot of custom controls within an InformationLayer. Eventually after interacting with the custom controls (within the Information Layer) we're getting a NullReferenceException within -

Telerik.Windows.Controls.Map.MapCanvas.MeasureOverride(Size availableSize)

The full stack trace is:

System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=Telerik.Windows.Controls.DataVisualization
  StackTrace:
   at Telerik.Windows.Controls.Map.MapCanvas.MeasureOverride(Size availableSize)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(Form mainForm)

It's hard to reproduce, or reproduce in a repeatitive fashion, but is there anyway we can either use a different pattern/place to have the controls or catch this exception? 

2 Answers, 1 is accepted

Sort by
0
Rob
Top achievements
Rank 1
answered on 17 Feb 2020, 01:05 PM
We can't use any other controls as we need the FrameworkElement of the information layer - https://docs.telerik.com/devtools/wpf/controls/radmap/features/information-layer/framework-elements
0
Petar Mladenov
Telerik team
answered on 18 Feb 2020, 12:04 PM

Hello Rob,

Our VisualizationLayer is created with the goal to entirely replace the InformationLayer in terms of covering all features and providing better performance when processing geometries, many elements inside, reading shape files. It supports adding FrameworkElements directly. Please check this section:

                   VisLayer - adding and positioning framework element

However, if you think InformationLayer is the preferred way to go on your side, you can try isolating this exception so that we can reproduce it on our side and suggest a workaround or log it with higher priority (because it is exception).

Regards,
Petar Mladenov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Map
Asked by
Rob
Top achievements
Rank 1
Answers by
Rob
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or