ThinkGeo.com    |     Documentation    |     Premium Support

WMS layer failure in v10

When I try and add a WMS layer into version 10, I get the following error:

at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at ThinkGeo.MapSuite.Portable.PclSystem.<>c__182.<Register>b__18_0(IPclSystem s, Object[] args) at fSQ=.lCQ=.<>c__DisplayClass2_0.<.ctor>b__0(IPclSystem ioc, Object[] args) at fSQ=.iiQ=.kyQ=(IPclSystem ioc, Object[] args, Boolean createNew) at fSQ=.lCQ=.lyQ=(IPclSystem ioc, Object[] args, Boolean createNew) at ThinkGeo.MapSuite.Portable.PclSystem.Resolve[T](Boolean createNew, String label, Object[] args) at ThinkGeo.MapSuite.Portable.PclSystem.Resolve[T](String label, Object[] args) at ThinkGeo.MapSuite.Portable.PclSystem.get_GeoRasterProjectionWrapper() at ThinkGeo.MapSuite.Shapes.Proj4Projection.ConvertToExternalProjectionCore(GeoImage image, RectangleShape imageExtent) at ThinkGeo.MapSuite.Shapes.Projection.ConvertToExternalProjection(GeoImage image, RectangleShape imageExtent) at ThinkGeo.MapSuite.Layers.RasterSource.GetImage(RectangleShape worldExtent, Int32 canvasWidth, Int32 canvasHeight) at ThinkGeo.MapSuite.Layers.WmsRasterLayer.DrawCore(GeoCanvas canvas, Collection1 labelsInAllLayers)
at ThinkGeo.MapSuite.Layers.Layer.ciU=(GeoCanvas canvas, Collection1 labelsInAllLayers) at ThinkGeo.MapSuite.Layers.Layer.Draw(GeoCanvas canvas, Collection1 labelsInAllLayers)
at ThinkGeo.MapSuite.WinForms.LayerOverlay.DrawCore(GeoCanvas canvas)
at ThinkGeo.MapSuite.WinForms.Overlay.YlM=(GeoCanvas canvas)
at ThinkGeo.MapSuite.WinForms.Overlay.Draw(GeoCanvas canvas)
at ThinkGeo.MapSuite.WinForms.WinformsMap.G1M=(IEnumerable`1 drawingOverlays, RectangleShape extent)
at ThinkGeo.MapSuite.WinForms.WinformsMap.GlM=(RectangleShape drawingExtent, RectangleShape extent)
at ThinkGeo.MapSuite.WinForms.WinformsMap.OVM=(RectangleShape extent)
at ThinkGeo.MapSuite.WinForms.WinformsMap.gRU=(Int32 delayInterval, RectangleShape extent)
at ThinkGeo.MapSuite.WinForms.WinformsMap.Refresh()
at WMS_v10.Form1.btnWMS_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(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)
at WMS_v10.Program.Main()
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(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 System.Threading.ThreadHelper.ThreadStart()

The same code works fine in v9. Attached is a test project.

Please advice.

Regards,
Damian

WMS_v10.zip (88.5 KB)

Hi Damian,

Our environment don’t have the 3rd part control, so I simplify your sample, but it looks the WMS cannot works, I tested both V9 and V10, it’s just looks the same.

Could you please view the sample, and modify it again for reproduce the exception?

9146.zip (18.5 KB)

Regards,

Ethan

Hi Ethan,

It looks like you tried to add all layers and I think this archive layer is probably not valid. I set it to just load 1 of the other layers and I get the right result.

After looking at your nuget package directory, I saw that I was missing the UnmanagedProj4Projection. Once I added this to my project, it also works fine.

I am curious though how can I know that this library is missing if my project builds fine and nuget doesn’t automatically include this library when another library requires it? Shouldn’t this be taken care of automatically?

Regards,
Damian

Hi Damian,

In fact when I run your project, it throw exception and tell me the UnmanagedProj4Projection package is missing, so I added it.

I think maybe you should try to open the exception detail information and you can see it.

Regards,

Ethan

Ethan,

Yes, that’s where you see the failure in runtime, but I think the fact that I was able to compile the project without error and that NuGet doesn’t automatically get this library is an issue.

Can you send me a list of what layers are dependent on UnmanagedProj4Projection?

Regards,
Damian

Hi Damian,

In fact we want to set automatic relationship for this package, but our developer think about many scenarios, and found in most of them this library is unused by user. And we think user will debug their project before publish, so throw when run is more acceptable than user have to download this package no matter they need it or not.

I think when you try to use projection in your map, you should want to download this package.

Regards,

Ethan

1 Like