I'm experiencing a crash in background overlay. I've tried to create a sample, but can't recreate the issue, so I figured I'd send the stack trace in case that helps. The maps visibility is bound to a WKT property and hidden when WKT does not exist. Below is my code I use for my property. The program crashes on the map.CenterAt(...) part with a parameter not valid exception.
private Address address;
public Address Address
{
get { return address; }
set
{
address = value;
if (address != null && !String.IsNullOrEmpty(value.WKT))
{
while (!map.Overlays.Contains("Data"))
Thread.Sleep(100);
BaseShape b = BaseShape.CreateShapeFromWellKnownData(value.WKT);
LayerOverlay lo = map.Overlays["Data"] as LayerOverlay;
(lo.Layers["Data"] as AddressViewLayer).Shape = b;
if (b is PointBaseShape)
ctxt.Send(new SendOrPostCallback(a => map.CurrentScale = map.ZoomLevelScales[15]), null);
else
ctxt.Send(new SendOrPostCallback(a => map.CurrentExtent = b.GetBoundingBox()), null);
ctxt.Send(new SendOrPostCallback(a => map.CenterAt(BaseShape.CreateShapeFromWellKnownData(value.WKT).GetCenterPoint())), null);
ctxt.Send(new SendOrPostCallback(a => map.Refresh()), null);
}
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs("Address"));
}
}
Thanks,
.Ryan.
---STACKTRACE---
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height)
at ThinkGeo.MapSuite.WpfDesktopEdition.BackgroundOverlay.DrawCore(RectangleShape targetExtent, OverlayRefreshType refreshType)
at ThinkGeo.MapSuite.WpfDesktopEdition.Overlay.Draw(RectangleShape targetExtent, OverlayRefreshType refreshType)
at ThinkGeo.MapSuite.WpfDesktopEdition.WpfMap.aBU=(Overlay axU=, RectangleShape bBU=, OverlayRefreshType bRU=)
at ThinkGeo.MapSuite.WpfDesktopEdition.WpfMap.YBU=(IEnumerable`1 ZRU=, RectangleShape ZhU=, OverlayRefreshType ZxU=)
at ThinkGeo.MapSuite.WpfDesktopEdition.WpfMap.YBU=(RectangleShape YRU=, OverlayRefreshType YhU=)
at ThinkGeo.MapSuite.WpfDesktopEdition.WpfMap.DrawCore(RectangleShape targetExtent, OverlayRefreshType overlayRefreshType)
at ThinkGeo.MapSuite.WpfDesktopEdition.WpfMap.Draw(RectangleShape targetExtent, OverlayRefreshType refreshType)
at ThinkGeo.MapSuite.WpfDesktopEdition.WpfMap.UBU=(RectangleShape URU=)
at ThinkGeo.MapSuite.WpfDesktopEdition.WpfMap.CenterAt(PointShape worldPoint)
at FutureConcepts.Data.Application.Views.AddressViewVM.<>c__DisplayClassf.<set_Address>b__a(Object a) in C:\Projects20\Data\Application\AppComponents\Views\AddressViewVM.cs:line 98
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, 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, Boolean ignoreSyncCtx)
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, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
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.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()