Hello,
I am switching from version 8 to version 9 (9.0.93.0) today, but I am having some problems. When I first set the .CurrentExtent, I am getting an ‘Object reference not set to an instance of an object’ error being thrown. Drilling down in the error info, here is the stack trace:
at xRM=.ICs=.JhQ=(Object objectToTest, String parameterName)
at ThinkGeo.MapSuite.Core.ExtentHelper.ToWorldCoordinate(RectangleShape worldExtent, ScreenPointF screenPoint, Single screenWidth, Single screenHeight)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.hxQ=(Object sender, MouseEventArgs e)
at System.Windows.Forms.MouseEventHandler.Invoke(Object sender, MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseMove(Message& m)
at System.Windows.Forms.Control.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 Hurrevac2010.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
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()
In addition, looking at the properties during runtime, the .CurrentScale shows “{“The parameter you supplied may not be null.\r\nParameter name: worldExtent”}”. This value is set to 18455993.4375 in the designer.
None of these values, and none of my code, has changed. What am I missing in version 9 that is causing these issues?
Thanks,
Dib
Problem switching to version 9
Hi Dib,
Have you found which object is null when you get the ‘Object reference not set to an instance of an object’ error?
Your exception looks strange, please double check your license status in product center.
Then pelase see if you can reproduce that in HowDoISample project.
Regards,
Don
Don,
I have downloaded Product Center 9.0, downloaded 9.0.97.0 from there, verified our Desktop Edition license, and referenced the DLLs. The error occurs when trying to set StormMap.CurrentExtent for the first time, to a defined RectangleShape. Putting a break point on that line, I can isolate the original error. The exception is a object reference error, the stack traces is:
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.set_CurrentExtent(RectangleShape value)
at Hurrevac2010.mapDraw_ThinkGeoV6.CenterMapOnStorm(Advisory theAdvisory) in mapDraw_ThinkGeoV6.vb:line 11725
at Hurrevac2010.Hurrevac2010.CenterMapOnStorm(Advisory theAdvisory) in Hur2010Form.vb:line 15260
at Hurrevac2010.Hurrevac2010.Hurrevac2010_Load(Object sender, EventArgs e) in Hur2010Form.vb:line 411
I know that the RectangleShape I am setting the CurrentExtent to is not nothing.
I’ve tried the managed assemblies, the strongly named assemblies, and even referencing them from the original install folder instead of the central repository we copy them to. Nothing in the code has changed, and if I reference the version 8 DLLs, everything runs as expected.
Hi Dib,
Thanks for let us know your issue.
But it’s very hard to reproduce here, I tried to use code build then test the dlls in package 93.0 and 97.0. Our HowDoISample works well for set winformsMap1.CurrentExtent.
So I still want to know whether the HowDoISample can works well in your machine for 9.0, because each sample contains the code set CurrentExtent.
And have you tried to remove our MapControl then re-add it to your project after you replace dll? I guess from your exception maybe in your project the map control is null.
Regards,
Don
Don,
If appears that anything that changes the size of the map (width or height) somehow sets the CurrentExtent to nothing, and any attempt to reset the CurrentExtent causes the error/stack trace listed above. I removed all references to changing the screen or map sizes in the application load, and it displayed correctly, but as soon as I resized the screen, the error immediately happened.
By the way, I could run the HowDoI samples.
I can send you a file with the map properties prior to the width being changed. Again, referencing version 8 makes it all work.
Got it. I was setting ZoomLevelSnapping to None, which seemed to be causing the problems. If I set it to default instead (or I assume any other value), the problem goes away.
This does present a couple of issues for us. We would set the ZoomLevelSnapping mode to None for two reasons:
1. So the mouse wheel would zoom at around 1/2 levels, and the user could zoom in more detail
2. We have an area selection tool, where the user can draw a box, and the map zooms to the selected area. Now it has to zoom out to the level where the entire selected area is shown, which is often further out than the user intended.
Can we get the None mode working again as it was in version 8?
Hi Dib,
Thanks for your report, when I set ZoomLevelSnapping to None I reproduce this issue.
I have found what’s change cause this issue and fixed it, please get the development daily build package tomorrow and let me know whether that works.
Regards,
Don
Don,
Will this be build 9.0.99.0?
Hi Dib,
Yes you’re right, it should be 99 or higher version.
Please let me know whether that fixed for you when you can get this version.
Regards,
Don
Any idea on when that will be?
Hi Dib,
It should be fixed in the latest daily build version 9.0.108.0 or later to have a try.
Thanks,
Johnny
Seems to be working, thanks
Great!
Any other questions, please feel free to let us know.
Thanks,
Troy