ThinkGeo.com    |     Documentation    |     Premium Support

Crash when caching in and running without debugger

Hi,


I just experienced a strange error. I have really simple code (below) using cache. When I run the application with debugging (F5), everything is ok. But if I run it without debugging (Ctrl+F5), it crashes with NullReferenceException and stack trace (below).


Regards,


Tomas


StackTrace::


   at ThinkGeo.MapSuite.DesktopEdition.x151ee226a0d6577e.DrawLineCore(IEnumerable`1 screenPoints, GeoPen linePen, DrawingLevel drawingLevel, Single xOffset, Single yOffset)

   at ThinkGeo.MapSuite.Core.GeoCanvas.x031f76d2da9fbe52(Byte[] x99e09ceb3e6636a9, Int32 xedf77fd65cf83220, Single xce919ea4a4b048be, Single x4e6c8c21e101dfe6, DrawingLevel x1aab732a2c56566f, GeoPen x0860aa02a02a22f7)

   at ThinkGeo.MapSuite.Core.GeoCanvas.DrawLine(Feature feature, GeoPen linePen, DrawingLevel drawingLevel, Single xOffset, Single yOffset)

   at ThinkGeo.MapSuite.Core.LineStyle.DrawCore(IEnumerable`1 features, GeoCanvas canvas, Collection`1 labelsInThisLayer, Collection`1 labelsInAllLayers)

   at ThinkGeo.MapSuite.Core.Style.Draw(IEnumerable`1 features, GeoCanvas canvas, Collection`1 labelsInThisLayer, Collection`1 labelsInAllLayers)

   at ThinkGeo.MapSuite.Core.ZoomLevel.DrawCore(GeoCanvas canvas, IEnumerable`1 features, Collection`1 currentLayerLabels, Collection`1 allLayerLabels)

   at ThinkGeo.MapSuite.Core.ZoomLevel.Draw(GeoCanvas canvas, IEnumerable`1 features, Collection`1 currentLayerLabels, Collection`1 allLayerLabels)

   at ThinkGeo.MapSuite.Core.FeatureLayer.DrawCore(GeoCanvas canvas, Collection`1 labelsInAllLayers)

   at ThinkGeo.MapSuite.Core.Layer.Draw(GeoCanvas canvas, Collection`1 labelsInAllLayers)

   at ThinkGeo.MapSuite.DesktopEdition.LayerOverlay.xa6cb874f7090c07f(GeoCanvas x31c084515ae9393f)

   at ThinkGeo.MapSuite.DesktopEdition.LayerOverlay.x17dceb203ee9599b(GeoCanvas x31c084515ae9393f, Boolean xa37df917bc29073e)

   at ThinkGeo.MapSuite.DesktopEdition.LayerOverlay.xbe0da0c2fd06aa90(GeoCanvas x31c084515ae9393f, Boolean xa37df917bc29073e)

   at ThinkGeo.MapSuite.DesktopEdition.LayerOverlay.DrawCore(GeoCanvas canvas)

   at ThinkGeo.MapSuite.DesktopEdition.Overlay.Draw(GeoCanvas canvas)

   at ThinkGeo.MapSuite.DesktopEdition.xf0380b1a0bc40ca6.StartDraw()

   at ThinkGeo.MapSuite.DesktopEdition.x601a5561df898600.StartDraw(Int32 tileWidth, Int32 tileHeight, RectangleShape tileExtent, Collection`1 overlays)

   at ThinkGeo.MapSuite.DesktopEdition.x601a5561df898600.DrawAddedExtents(IEnumerable`1 addedExtents, Collection`1 overlays)

   at ThinkGeo.MapSuite.DesktopEdition.x65fdca92d79c01f5.Refresh(x177b8d80e88ce3a2 tempRedrawMode)

   at ThinkGeo.MapSuite.DesktopEdition.WpfMap.x9ac8c50f434f4b39(x177b8d80e88ce3a2 x4b4ac2606ceb15cc)

   at ThinkGeo.MapSuite.DesktopEdition.WpfMap.Refresh()

   at ThinkGeoTest.Window1.Window1_OnLoaded(Object sender, RoutedEventArgs e) in D:\logis\projects\ThinkGeoTest\CacheInReleaseCrash\Window1.xaml.cs:line 27

   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)

   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)

   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)

   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)

   at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)

   at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)

   at MS.Internal.LoadedOrUnloadedOperation.DoWork()

   at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()

   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.Media.MediaContext.Resize(ICompositionTarget resizedCompositionTarget)

   at System.Windows.Interop.HwndTarget.OnResize()

   at System.Windows.Interop.HwndTarget.HandleMessage(Int32 msg, IntPtr wparam, IntPtr lparam)

   at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(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, Boolean isSingleParameter)

   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)

   at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)

   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)

   at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)

   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

   at MS.Win32.UnsafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)

   at System.Windows.Window.ShowHelper(Object booleanBox)

   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)

   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)

   at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)

   at System.Windows.Threading.DispatcherOperation.InvokeImpl()

   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)

   at System.Threading.ExecutionContext.runTryCode(Object userData)

   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)

   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

   at System.Threading.ExecutionContext.Run(ExecutionContext 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, Boolean isSingleParameter)

   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)

   at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)

   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)

   at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)

   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)

   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)

   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)

   at System.Windows.Threading.Dispatcher.Run()

   at System.Windows.Application.RunDispatcher(Object ignore)

   at System.Windows.Application.RunInternal(Window window)

   at System.Windows.Application.Run(Window window)

   at System.Windows.Application.Run()

   at ThinkGeoTest.App.Main() in D:\logis\projects\ThinkGeoTest\CacheInReleaseCrash\obj\Debug\App.g.cs:line 0


 The code:



ShapeFileFeatureLayer streets1Layer = new ShapeFileFeatureLayer(@"..\..\AustinStreets\Austinstreets.shp"); 
streets1Layer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.LocalRoad4; 
streets1Layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; map.StaticOverlay.Layers.Add("Streets1", streets1Layer); 
map.StaticOverlay.ClientCache.CacheDirectory = @"..\..\Cache";  
map.CurrentExtent = new RectangleShape(-97.8, 30.4, -97.7, 30.2); 
map.Refresh();  



Tomas, 
  
 Thanks for pointing this out. I have recreated this issue and added it to our tracking system; we will review it before the next release in next week. 
  
 Thanks, 
 ThinkGeo Support