ThinkGeo.com    |     Documentation    |     Premium Support

Thorough testing done on 120DPI settings Windows XP?

Hello,


Our desktop application has been running error free for quite some time. We have customers who wish to use 120dpi resolution settingson their desktops due to poor eye sight and/or preference.


When we run our application in 120DPI, we receive the elusive "Parameter is not valid." error on map.Refresh. It is highly difficult to recreate in a seperate application as our application features two map objects that interact with each other. I find it odd that changing the dpi settings takes our solid app and essentially introduces intermittent errors of this nature.


I was able to get around the majority of map.refresh errors by doing map.refresh(map.overlays) which is really very odd for me to even have to do... still, I was going to go with it.


The only problem is now I am seeming generating this error on draw somewhere inside of your component or on another thread inside of your component (I think the former because no invocation error msg comes up but the stack trace does make mention of threading.), I belive this because the error no longer points to any line of code in my project when the exception occurs.


Message: "Parameter is not valid."


Source: "DesktopEdition"


StackTrace:  "   at ThinkGeo.MapSuite.DesktopEdition.Overlay.Draw(GeoCanvas canvas)\r\n   at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x03e3d48bcfe7bb6c(IEnumerable`1 xa6f0db4f183189f1)\r\n   at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.xff5b27c00f9678c2(RectangleShape x178b193eec228e6e)\r\n   at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.xe3cee4adb9c72451()\r\n   at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x9ac8c50f434f4b39(Int32 xb565f4681f05557a)\r\n   at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.OnPaint(PaintEventArgs e)\r\n   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)\r\n   at System.Windows.Forms.Control.WmPaint(Message& m)\r\n   at System.Windows.Forms.Control.WndProc(Message& m)\r\n   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)\r\n   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)\r\n   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)\r\n   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)\r\n   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)\r\n   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)\r\n   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)\r\n   at System.Windows.Forms.Application.Run(ApplicationContext context)\r\n   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()\r\n   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()\r\n   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)\r\n   at GeoTMSMapViewer.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81\r\n   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)\r\n   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)\r\n   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()\r\n   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)\r\n   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n   at System.Threading.ThreadHelper.ThreadStart()"


TargetSite: {Void Draw(ThinkGeo.MapSuite.Core.GeoCanvas)}


DeclaringMethod: '((System.Type)(((System.Reflection.MemberInfo)(((System.Exception)($exception)).TargetSite)).ReflectedType)).DeclaringMethod' threw an exception of type 'System.InvalidOperationException'


[System.SystemException {System.InvalidOperationException}] {"Method may only be called on a Type for which Type.IsGenericParameter is true."}


If this sounds like something that needs a support ticket, please let me know so I can open one up.


Thanks.



Nelson,


Thanks for your post and information.
 
As you said, this problem is very hard to recreate, could you give me following information , I will review the code then to see whether I could have some luck.
1)      How you set the DPI from default value (96) to 120? Can you show me the code?
2)      MapControl version is 3.1.299?
3)      Are you using the multithreaded mode in your application?
4)      How 2 Maps interacts with each other, can you have a brief description.
 
Please feel free to let me know any more questions.
 
Thanks.
 
Yale

Hi Yale, 
  
 Thanks for your response. Let me answer your questions in the order they were asked. 
  
 1) The DPI is not set  in code from 96dpi to 120dpi. It is a Windows System setting. For Windows XP, it is found in Display Properties. In the Settings tab, there is an Advanced button. Click that, and you will see the setting. It will likely require a restart and will probably annoyingly rearrange your desktop and various other layouts. 
  
 2) Yes, I have the latest version 3.1.299. It is VERY good! 
  
 3) I am using single-threaded mode, but I do notice multi-threaded has been vastly improved. 
  
 4) I have two map controls as you know. One is the main map that you interact with as normal. You pan, zoom, etc in this map. We can call this Map1 for sake of ease. Map2 is essentially a locus map. No zooming or panning is done in this map. All layers that are added to map1 are Cloned Deep and added to map2. This is because while all layers may be visible in map1, only one layer at a time will be visible in map2. 
  
 The Map1.CurrentExtents are used to create a feature in Map2.EditOverlay. This represents our viewable area. You can drag this feature in Map2 anywhere and on MouseUp, Map1.CurrentExtent is set to wherever this Map2.EditOverlay’s feature was placed. 
  
 This just about covers the relationship between the two map controls. I hope that was helpful?

Nelson,


Thanks for your post and information.
 
I am sorry to say that my sample (attachment) cannot recreate your problem even though I make it run a couple of hours in Windows XP x86 120 DPI environment. If you want, could you have a try at the sample? Also, I reviewed the code and did not see any possibility this problem would happen within two map controls.
 
Before you run this sample, please:
Copy the Countries02.shp files to the data folder.
Copy the Desktop Edition references (4 DLLs) to the Dependencies folder.
 
I guess we need more discussions on this problem to figure it out.
 
Thanks.
 
Yale

1565-DPI_Test_Sample.zip (10.8 KB)

Yale, 
  
 That is not too surprising, unfortunately. One thing I was curious about was if this project was created and tested in 120DPI. My scenario involves a project that was created and tested on 96DPI and then I changed my desktop to 120DPI and began testing. I think this may be part of the issue. 
  
 I think if you started the project when your desktop was already at 120DPI, you may not run into the scenario as easily or at all. 
  
 Thanks, 
 Nelson

Nelson, 
  
 I hope my following test steps is what we are trying to achieve: 
 1) Create the sample in DPI 96 Windows7 environment and compile the exe for the application. 
 2) Copy the files to an environment Windows XP 120 DPI and test it with the exe. 
  
 Besides, I also tested the extreme case, when the application is running, I changed randomly the DPI setting without restart the computer, even thought Microsoft says it will only take effect after the computer was restarted, while I can say it should have taken effect because I noticed the font size changed. 
  
 Any more questions just feel free to let me know. 
  
 Thanks. 
  
 Yale 


Yes, those are the steps necessary to test out the possibility. Is there a way I can submit a support ticket and have this behavior observed within my code?


 Nelson, 
  
 Could you try to contact our support(support@thinkgeo.com) to see when a go-to-meeting or something similar can be arranged? 
  
 Thanks for your patience. 
  
 Yale 


I am reviving this thread because I was taken away from this project around the point that we left off and a decent amount of time has since passed. 
  
 Yale, is it still ok for me to contact support and see when a Go-To-Meeting or something along those lines can be arranged? 
  
 Thanks, 
 Nelson

Nelson, 
  
 I am afraid Yale can not do that immediately because he is not available this week for some reason. 
  
 You can contact support and let them know this thing first, and after Yale back we will contact you and arrange a Go-To-Meeting to solve the problem. 
  
 Thanks 
 James 


Sounds good, James. I’ll contact support and see if they can schedule me for when Yale returns. Thank you.

Nelson, 
  
 You’re welcome and thanks for your patience. 
  
 James

Has Yale made it back yet? I’ve been asked about any progress on this. Thanks.

Nelson, 
  
   Yale hasn’t made it back yet.  His dad had an emergency medial condition and is under observation for a few weeks.  He wanted to stay there for that.  I expect him to get back next week.  So far his dad is doing well, send some good thoughts his way…  I will see if there is someone else who can help out but he is really the key person for that.  Worse comes to worse I may be able to squeeze you in. :-) 
  
 David

I’m really sorry to hear about that David. We’ll see how it goes next week.

Dave, is it possible to arrange a meeting for the 2nd or 3rd of February (next week)? We have a customer who is kind of anxious for our implementation of this support and I don’t want to let it slip too far. Waiting until next week is acceptable. 
  
 Thanks.

Nelson, 
  
 I am very sorry for my absense for my private stuff in the past few weeks. Now, I am back, hopefully we can have some time together to fix the DPI problem. 
  
 As I said in previous posts, I still cannot recreate this problem, if could, we can have a go-to-meeting as soon as possible to recreate the problem in your enviroment? 
  
 Any more questions just feel free to let me know. 
  
 Thanks. 
  
 Yale 


No need to apologize, Yale. Let me know when you are available. Perhaps tomorrow?

Nelson,


Today is Friday, just let me know when you are available. I am free anytime for you:).
 
Any more questions just feel free to let me know.
 
Thanks.
 
Yale

Are you available for 10:00AM EST?