ThinkGeo.com    |     Documentation    |     Premium Support

Can't open the OSM Overlay Sample design on Visual Studio

I’m trying to open the design for the OSM overlay sample from the samples available, but Visual Studio throws this error and crashes eventually:

[12:49:08.203335] warn: [HowDoI]: Could not resolve type for System.ComponentModel.Design.Serialization.TypeCodeDomSerializer .
[12:49:08.204333] warn: [HowDoI]: Could not resolve type for System.ComponentModel.Design.Serialization.TypeCodeDomSerializer .
[12:49:08.205316] warn: [HowDoI]: Could not resolve type for System.ComponentModel.Design.Serialization.TypeCodeDomSerializer .
[12:49:08.205316] warn: [HowDoI]: Could not resolve type for System.ComponentModel.Design.Serialization.TypeCodeDomSerializer .
[12:49:08.205316] warn: [HowDoI]: Could not resolve type for System.ComponentModel.Design.Serialization.TypeCodeDomSerializer .
[12:49:08.205316] warn: [HowDoI]: Could not resolve type for System.ComponentModel.Design.Serialization.TypeCodeDomSerializer .
[12:49:08.206317] warn: [HowDoI]: Could not resolve type for System.ComponentModel.Design.Serialization.TypeCodeDomSerializer .
[12:49:08.206317] warn: [HowDoI]: Could not resolve type for System.ComponentModel.Design.Serialization.TypeCodeDomSerializer .
[12:49:08.206317] warn: [HowDoI]: Could not resolve type for System.ComponentModel.Design.Serialization.TypeCodeDomSerializer .
[12:49:08.207314] warn: [HowDoI]: Could not resolve type for System.ComponentModel.Design.Serialization.TypeCodeDomSerializer .
[12:49:08.207314] warn: [HowDoI]: Could not resolve type for System.ComponentModel.Design.Serialization.TypeCodeDomSerializer .
[12:49:08.207314] warn: [HowDoI]: Could not resolve type for System.ComponentModel.Design.Serialization.TypeCodeDomSerializer .
[12:49:08.207314] warn: [HowDoI]: Could not resolve type for System.ComponentModel.Design.Serialization.TypeCodeDomSerializer .
[12:49:08.214329] warn: [HowDoI]: Could not resolve type for System.ComponentModel.Design.Serialization.TypeCodeDomSerializer .
[12:49:09.770705] fail: [HowDoI]: Unhandled exception. System.ArgumentOutOfRangeException: The value for the enumeration is not one of the valid values. (Parameter 'mapUnit')
[12:49:09.770705] fail: [HowDoI]:    at ThinkGeo.Core.ValidatorHelper.CheckGeographyUnitIsValid(GeographyUnit geographyUnit, String parameterName)
[12:49:09.770705] fail: [HowDoI]:    at ThinkGeo.Core.MapUtil.GetScale(GeographyUnit mapUnit, RectangleShape boundingBox, Double widthInPixel, Double heightInPixel, Single dpi)
[12:49:09.770705] fail: [HowDoI]:    at ThinkGeo.Core.MapUtil.bx0=(RectangleShape targetExtent, Single actualWidth, Single actualHeight, Double maximumScale, Double minimumScale, GeographyUnit mapUnit)
[12:49:09.770705] fail: [HowDoI]:    at ThinkGeo.Core.MapUtil.AdjustExtentByRestrictions(RectangleShape targetExtent, Single width, Single height, RectangleShape restrictExtent, Double maximumScale, Double minimumScale, GeographyUnit mapUnit)
[12:49:09.771705] fail: [HowDoI]:    at ThinkGeo.Core.MapViewBase.DrawCore(RectangleShape targetExtent, OverlayRefreshType overlayRefreshType)
[12:49:09.771705] fail: [HowDoI]:    at ThinkGeo.Core.MapViewBase.Draw(RectangleShape targetExtent, OverlayRefreshType refreshType)
[12:49:09.771705] fail: [HowDoI]:    at ThinkGeo.Core.MapViewBase.MEU=(Object sender, EventArgs e)
[12:49:09.771705] fail: [HowDoI]:    at System.Windows.Threading.DispatcherTimer.FireTick()
[12:49:09.771705] fail: [HowDoI]:    at System.Windows.Threading.DispatcherTimer.<>c.<Restart>b__21_0(Object state)
[12:49:09.771705] fail: [HowDoI]:    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
[12:49:09.772706] fail: [HowDoI]:    at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
[12:49:09.772706] fail: [HowDoI]:    at System.Windows.Threading.DispatcherOperation.InvokeImpl()
[12:49:09.772706] fail: [HowDoI]:    at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
[12:49:09.772706] fail: [HowDoI]:    at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
[12:49:09.772706] fail: [HowDoI]:    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
[12:49:09.773736] fail: [HowDoI]: --- End of stack trace from previous location ---
[12:49:09.773736] fail: [HowDoI]:    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
[12:49:09.773736] fail: [HowDoI]:    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
[12:49:09.773736] fail: [HowDoI]:    at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
[12:49:09.774734] fail: [HowDoI]:    at System.Windows.Threading.DispatcherOperation.Invoke()
[12:49:09.774734] fail: [HowDoI]:    at System.Windows.Threading.Dispatcher.ProcessQueue()
[12:49:09.774734] fail: [HowDoI]:    at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
[12:49:09.774734] fail: [HowDoI]:    at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
[12:49:09.774734] fail: [HowDoI]:    at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
[12:49:09.774734] fail: [HowDoI]:    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
[12:49:09.774734] fail: [HowDoI]:    at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
[12:49:09.775705] fail: [HowDoI]:    at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
[12:49:09.775705] fail: [HowDoI]:    at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
[12:49:09.775705] fail: [HowDoI]:    at Interop.User32.DispatchMessageW(MSG& msg)
[12:49:09.775705] fail: [HowDoI]:    at System.Windows.Forms.Application.ComponentManager.Interop.Mso.IMsoComponentManager.FPushMessageLoop(UIntPtr dwComponentID, msoloop uReason, Void* pvLoopData)
[12:49:09.775705] fail: [HowDoI]:    at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(msoloop reason, ApplicationContext context)
[12:49:09.775705] fail: [HowDoI]:    at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(msoloop reason, ApplicationContext context)
[12:49:09.775705] fail: [HowDoI]:    at System.Windows.Forms.Application.Run(ApplicationContext context)
[12:49:09.775705] fail: [HowDoI]:    at Microsoft.DotNet.DesignTools.Server.DesignToolsServer.<>c__DisplayClass54_0.<StartUIThreadAsync>b__1()
[12:49:09.776705] fail: [HowDoI]:    at System.Threading.Thread.StartHelper.Callback(Object state)
[12:49:09.776705] fail: [HowDoI]:    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
[12:49:09.776705] fail: [HowDoI]: --- End of stack trace from previous location ---
[12:49:09.776705] fail: [HowDoI]:    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
[12:49:09.776705] fail: [HowDoI]:    at System.Threading.Thread.StartCallback()
[12:49:15.000352] fail: StreamJsonRpc.ConnectionLostException: The JSON-RPC connection with the remote party was lost before the request could complete.
                           at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                           at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__154.MoveNext()
                        --- End of stack trace from previous location where exception was thrown ---
                           at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                           at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__143`1.MoveNext()
                        --- End of stack trace from previous location where exception was thrown ---
                           at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                           at Microsoft.DotNet.DesignTools.Client.DesignToolsClient.<SendRequestAsync>d__49`1.MoveNext()

Any fixes?

Hey @Gabriel_Amado,

Thanks for pointing that out. I can reproduce this on our samples as well. Here’s a workaround for you:

Instead of opening up the designer, open the code behind and add the following line in the InitializeComponent method:

this.mapView.MapUnit = ThinkGeo.Core.GeographyUnit.Meter;

It should look like this:

After you add that, you’ll be able to open up the designer.

Thanks,
Kyle

1 Like

That fixed it! Thanks!

Hey @Gabriel_Amado,

Good to hear!

Thanks,
Kyle