Hi Cui,
Thanks for the reply and putting some extra hours in on this. I am encouraged that you don't get the error. That probably means we can narrow it down. I haven't gotten any emails with the updated project though, but will test as soon as it comes through.
Regarding point 5, I need to save to a single file as the idea is that we only have to send 1 file around between users working on the same project. Right now, I am serializing around 200 objects per session and having them in individual xml files is not practical.
Understood on point 8. However, I still think there may be an issue deserializing shape layers when a prj file is not supplied even if the xml is being written out as designed.
Here's the stack trace produced when I get the error on my machine. Notice that WinformsMap now pops up. Googling these types of errors, I've seen lots of references where null objects caused the problem. I see the HxY method/property is unspecified below.
System.AccessViolationException was unhandled
Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source=System.Drawing
StackTrace:
at System.Drawing.SafeNativeMethods.Gdip.GdipDrawImageI(HandleRef graphics, HandleRef image, Int32 x, Int32 y)
at System.Drawing.Graphics.DrawImage(Image image, Int32 x, Int32 y)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.0hU=(IEnumerable`1 0xU=)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.0BU=(RectangleShape 0RU=)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.HxY=()
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.GxY=(Int32 HBY=)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.Refresh(IEnumerable`1 redrawOverlays)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.Refresh(Overlay redrawOverlay)
at GeoSerializerTest.Form1.button2_Click(Object sender, EventArgs e) in C:\Users\dhite\Documents\Visual Studio 2010\Projects\MapSuiteExamples\GeoSerializerShapeTest\GeoSerializerTest\Form1.cs:line 144
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.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 GeoSerializerTest.Program.Main() in C:\Users\dhite\Documents\Visual Studio 2010\Projects\MapSuiteExamples\GeoSerializerShapeTest\GeoSerializerTest\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
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.Threading.ThreadHelper.ThreadStart()
InnerException:
Regards,
Damian