Question

I am using gmap.net Map control in my winform application. it is running good at developers computers but crash on clients computers Although we update all sytems. but after few minute the map is crash and give following net framework errorenter image description here

Was it helpful?

Solution

I have used the GMap.NET control in the past, and I ran into a similar problem. Judging by the big fat red cross in the background, the GMap.NET control has crashed during its OnPaint method. The enumeration operation may not execute error that is thrown is typically caused by modifying a collection while iterating it: this is something that most collection types in the framework do not allow.

In its OnPaint method, the GMap.NET control iterates numerous collections, amongst other the GMapControl.Overlays collection and the GMapOverlay.Markers, GMapOverlay.Routes and GMapOverlay.Polygons collections of these overlays. In my case, I was modifying these collections from a background thread while the control was trying to do its painting, and thus iterating these collections. This resulted in behaviour similar to what you are observing now.

I noticed that GMap.NET uses a custom collection class called ObservableCollectionThreadSafe<T> for all of the abovementioned collection. The name implies thread-safety and thus possible tolerance for modifications during iteration, but I haven't studied its implementation so I am not sure whether this is true. My observations seemed to indicate otherwise, but this was quite a while ago.

At the time, I solved my problems by invoking modifications to the abovementioned collections to the GUI thread (by lack of a synchronization object to lock on). Invoking ensures that the modifications cannot possibly run simultaneously with the GMapControl.OnPaint method, which will always run on the GUI thread as well.

As to why you are not observing this behaviour on your machine: this could be due to numerous reasons. Perhaps you got lucky, perhaps you're using the application differently than the client, etc.

You can probably get more helpful answers to your question on the GMap.NET discussions forum by the way.

OTHER TIPS

The user version maybe missing the specific Windows Form DLL as-well as the Core.DLL This depends on what the User Version is running from i.e Visual Studio or Packaged .NET Application that has been installed onto the User's PC. If this is not the case it may be best to seek help from the GMap Forums.

To fix this, you have to disable invalidation whilst updating or adding markers or polygons:

MyMap.HoldInvalidation = True

'
' Add markers or polygons now
' 

MyMap.HoldInvalidation = False      ' Not sure if this line is needed
MyMap.Refresh()

you are missing the dll which are required to run the application, i would suggest to copy the complete bin folder on your local system and then try to run the application. if you have created msi package them make sure the dependency are added properly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top