kuiperfoliage

PolylineClip.cs and this.boundary.SpatialReference

Discussion created by kuiperfoliage on Aug 22, 2013
Latest reply on Sep 8, 2013 by kuiperfoliage
Hi,

I ran into an issue where Clip within PolylineClip.cs throws an NullPointerException. This only happens when i run with AcceleratedDisplay DISABLED. The layer is loaded fine when AcceleratedDisplay is turned on.

this.boundary.SpatialReference is null on the construction of PolylineClip.cs and therefore crashes on the second line of the Clip method where the Dateline is being retrieved from the SpatialReference.

The error seems to only happen when i have three specific layers loaded at startup. If i disable anyone of them the nullreferenceexception doesn't occur. I load a baselayer and two graphicslayers (one just polylines and one with polylines and polygons).

I hope this is helpful

Here is the callstack:
> ESRI.ArcGIS.Client.dll!ESRI.ArcGIS.Client.Utils.Clipping.PolylineClip.Clip(ESRI.ArcGIS.Client.Geometry.Polyline polyline, bool isWrapping) Line 25 + 0x36 bytes C#
  ESRI.ArcGIS.Client.dll!ESRI.ArcGIS.Client.LayerCanvas.SetClip(ESRI.ArcGIS.Client.Symbols.GraphicElement ge, ESRI.ArcGIS.Client.Geometry.Envelope clip, bool isWrapping) Line 529 + 0x94 bytes C#
  ESRI.ArcGIS.Client.dll!ESRI.ArcGIS.Client.LayerCanvas.ArrangeGraphic(ESRI.ArcGIS.Client.Symbols.GraphicElement elm, ESRI.ArcGIS.Client.Geometry.Envelope clipbox) Line 61 C#
  ESRI.ArcGIS.Client.dll!ESRI.ArcGIS.Client.LayerCanvas.ArrangeOverride(System.Windows.Size finalSize) Line 128 C#
  PresentationFramework.dll!System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect finalRect) + 0x6cf bytes
  PresentationCore.dll!System.Windows.UIElement.Arrange(System.Windows.Rect finalRect) + 0x7f0 bytes
  PresentationCore.dll!System.Windows.ContextLayoutManager.UpdateLayout() + 0x864 bytes
  PresentationCore.dll!System.Windows.Interop.HwndSource.SetLayoutSize() + 0x311 bytes
  PresentationCore.dll!System.Windows.Interop.HwndSource.RootVisualInternal.set(System.Windows.Media.Visual value) + 0x10d bytes
  PresentationFramework.dll!System.Windows.Window.SetRootVisualAndUpdateSTC() + 0x86 bytes
  PresentationFramework.dll!System.Windows.Window.SetupInitialState(double requestedTop, double requestedLeft, double requestedWidth, double requestedHeight) + 0xa0e bytes
  PresentationFramework.dll!System.Windows.Window.CreateSourceWindow(bool duringShow) + 0x3c6 bytes
  PresentationFramework.dll!System.Windows.Window.ShowHelper(object booleanBox) + 0x87 bytes
  ESRI.ArcGIS.Client.dll!ESRI.ArcGIS.Client.LegendSymbol.OpenContainer() Line 210 + 0x5d bytes C#
  ESRI.ArcGIS.Client.dll!ESRI.ArcGIS.Client.LegendSymbol.ToImageSource(System.Action<System.Windows.Media.ImageSource> callback) Line 280 C#
  ESRI.ArcGIS.Client.dll!ESRI.ArcGIS.Client.WaitSymbols.Add(ESRI.ArcGIS.Client.LegendItemInfo legendItemInfo, ESRI.ArcGIS.Client.Symbols.Symbol symbol) Line 29 C#
  ESRI.ArcGIS.Client.dll!ESRI.ArcGIS.Client.UniqueValueRenderer.QueryLegendInfos(System.Action<ESRI.ArcGIS.Client.LayerLegendInfo> callback, System.Action<System.Exception> errorCallback) Line 169 C#
  ESRI.ArcGIS.Client.dll!ESRI.ArcGIS.Client.GraphicsLayer.QueryLegendInfos(System.Action<ESRI.ArcGIS.Client.LayerLegendInfo> callback, System.Action<System.Exception> errorCallback) Line 1989 C#
  ESRI.ArcGIS.Client.Toolkit.dll!ESRI.ArcGIS.Client.Toolkit.MapLayerItem.Refresh.AnonymousMethod__0() + 0xc4 bytes
  WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) + 0x128 bytes
  WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source, System.Delegate method, object args, int numArgs, System.Delegate catchHandler) + 0x47 bytes
  WindowsBase.dll!System.Windows.Threading.Dispatcher.WrappedInvoke(System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) + 0x5d bytes
  WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl() + 0xb1 bytes
  mscorlib.dll!System.Threading.ExecutionContext.runTryCode(object userData) + 0x178 bytes
  [Native to Managed Transition]
  [Managed to Native Transition]
  mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool ignoreSyncCtx) + 0xa1 bytes
  mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x3b bytes
  WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke() + 0x6d bytes
  WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue() + 0x27f bytes
  WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0xb3 bytes
  WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0x13d bytes
  WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) + 0x97 bytes
  WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) + 0x5a bytes
  WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source, System.Delegate method, object args, int numArgs, System.Delegate catchHandler) + 0x47 bytes
  WindowsBase.dll!System.Windows.Threading.Dispatcher.WrappedInvoke(System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) + 0x5d bytes
  WindowsBase.dll!System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) + 0xd2 bytes
  WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) + 0x164 bytes
  [Native to Managed Transition]
  [Managed to Native Transition]
  WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame) + 0x13a bytes
  PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) + 0x12f bytes
  PresentationFramework.dll!System.Windows.Application.Run() + 0xbb bytes
  XXX.exe!XXX.App.Main() + 0xd5 bytes C#
  [Native to Managed Transition]
  [Managed to Native Transition]
  Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() + 0x48 bytes
  mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool ignoreSyncCtx) + 0xdc bytes
  mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x3b bytes
  mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x4d bytes
  [Native to Managed Transition]

Outcomes