ThinkGeo.com    |     Documentation    |     Premium Support

Exception thrown serializing WmtsLayer

Hi,

I am trying to serialize a WmtsLayer. I get the following exception:

System.InvalidOperationException
HResult=0x80131509
Message=kxc=.I0U= is not marked as serializable
Source=ThinkGeo.MapSuite
StackTrace:
at ThinkGeo.MapSuite.Serialize.GeoObjectModeler.pCY=(Object serializationObject, GeoObjectNode baseObjectModel, String nodeName, Type parentType)
at ThinkGeo.MapSuite.Serialize.GeoObjectModeler.sCY=(IEnumerable sequence, GeoObjectNode objectModel)
at ThinkGeo.MapSuite.Serialize.GeoObjectModeler.pCY=(Object serializationObject, GeoObjectNode baseObjectModel, String nodeName, Type parentType)
at ThinkGeo.MapSuite.Serialize.GeoObjectModeler.CreateMemberNodeCore(String memberName, Object memberValue, Type memberType, Object memberOwner, GeoObjectNode baseMemberNode)
at ThinkGeo.MapSuite.Serialize.GeoObjectModeler.CreateMemberNode(String memberName, Object memberValue, Type memberType, Object memberOwner, GeoObjectNode baseMemberNode)
at ThinkGeo.MapSuite.Serialize.GeoObjectModeler.sSY=(Object serializationObject, GeoObjectNode currentModel)
at ThinkGeo.MapSuite.Serialize.GeoObjectModeler.pCY=(Object serializationObject, GeoObjectNode baseObjectModel, String nodeName, Type parentType)
at ThinkGeo.MapSuite.Serialize.GeoObjectModeler.oiY=(Object modelSource)
at ThinkGeo.MapSuite.Serialize.GeoObjectModeler.CreateModel(Object objectToModel, GeoObjectModelerMemberTypes memberTypes, BindingFlags bindingFlags, GeoObjectModelerDefaultValueMode defaultValueMode)
at ThinkGeo.MapSuite.Serialize.GeoSerializer.Serialize(Object objectToSerialize, String targetPathFilename)
at WindowsApplication1.Form.DisplayWMTSLayer() in C:\Users\steller\Documents\Visual Studio 2015\Projects\ThinkGeo\WinForms\Planet Test\Form1.vb:line 59
at WindowsApplication1.Form.Form1_Load(Object sender, EventArgs e) in C:\Users\steller\Documents\Visual Studio 2015\Projects\ThinkGeo\WinForms\Planet Test\Form1.vb:line 14
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.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)

Is it a bug?

Thanks!

Steve

Hi Steve,

Thanks to let us know it.

Yes it’s a bug, our developer had fixed it.

You can get it in the packages today later.

Because the fix is simple, we also move it into release for you.

We will look into the pdf and printer problem again and move that into release after make sure it get solved next week.

Regards,

Ethan

Hi Ethan,

I am still having a problem. If you serialize the Wmts layer after it has been added to a map, there is still an exception. Please have a look at my sample project.

Thanks!

Steve
WmtsDemo.zip (514.3 KB)

Hi Steve,

Thanks for your sample, we had fixed that, please get the latest development package today.

And you should want to pass a file path but not a folder path in this line: oSerializer.Serialize(moWmtsLayer, sPath)

Orelse it will met another exception:
Cannot create “C:\Temp\TestSerializeWmtsLayer” because a file or directory with the same name already exists.

Regards,

Ethan

Hi Ethan,

I got the latest beta (11.0.0-beta025) and it’s still not working for me.

I get:
System.Reflection.TargetInvocationException
HResult=0x80131604
Message=Exception has been thrown by the target of an invocation.
Source=mscorlib
StackTrace:
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
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.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.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 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at WindowsApplication1.My.MyApplication.Main(String[] Args) in :line 81

Inner Exception 1:
ArgumentException: Invalid name character in ‘hkU=’. The ‘=’ character, hexadecimal value 0x3D, cannot be included in a name.

Thanks!

Steve

Hi Steve,

I tested the latest package with your sample, it looks I hadn’t met the same exception:

Have you tried to clean your cache and test it again?

Regards,

Ethan

Hi Ethan,

OK, if I use the latest beta of WmtsLayer the serialization works well. However, I want to create a class that inherits from WmtsLayer. When I did that I tried to figure out what was wrong with my class that could be causing the problem, so I removed all of the properties and methods but still I get the error. So here is another sample project with the class that inherits from WmtsLayer so you can see what I mean. Is there a solution for it?

Thanks!

Steve
WmtsDemo.zip (852.5 KB)

Hi Steve,

Thanks for your sample, that’s still be the problem in WMTS layer, please try this version or higher one:

Regards,

Ethan

Ethan,

Working now!

You already know what I’m going to ask. When can I get this in a production build?

Thanks very much!

Steve

Hi Steve,

We will move it to release branch, please get the new package today.

Regards,

Ethan