Trouble with SetCurrentPositionByKeywords()

Topics: General
Oct 29, 2012 at 5:43 PM

Is it possible to add a new map source to GMapProviders when using the binary download of the libraries, or will I have to start from source?

I was able to add my own class for a new map source, and it mostly works. Unfortunately if a Gmap control (Winforms) has the SetCurrentPositionByKeywords() method performed on it, I get an exception. Is it necessary for my new map source to be part of GMapProviders for SetCurrentPositionbyKeywords() to work?

Oct 29, 2012 at 5:54 PM

what exception?

Oct 29, 2012 at 5:55 PM

My bad, I forgot to specify that. Here  you go:

"The type initializer for 'GMap.NET.MapProviders.GMapProviders' threw an exception."

Oct 29, 2012 at 6:18 PM

and what is exception message?

Oct 29, 2012 at 6:59 PM

"The type initializer for 'GMap.NET.MapProviders.GMapProviders' threw an exception." is the most detailed exception message that I can get. I'm running from the binary version of v1.6 (stable release). 

It is an exception of type "System.TypeInitializationException".

What would be the best way to download the source version of v1.6?

Oct 29, 2012 at 7:11 PM


catch(Exception ex)



Oct 29, 2012 at 7:18 PM

Agreed, that is the method I was using to find the message. The results are message box that shows the following text:

"The type initializer for 'GMap.NET.MapProviders.GMapProviders' threw an exception."

Looking further, it looks like I'll need to add my new source to GmapProviders. If I initialize to my map source (not in GmapProvders) I encounter an exception upon attempting to change map types.

Otherwise, is it possible to set a Control.MapProvider property to something other than an element in the GmapProviders enum?

Thank you for your time.

Oct 29, 2012 at 7:24 PM


(Exception ex)

Oct 29, 2012 at 7:30 PM

InnerException is null.

Oct 29, 2012 at 7:45 PM

It looks like rev "dbfffa5b4adc" is the 1.6 release. I'll try using that source code.

Nov 2, 2012 at 4:42 PM

Good news; since I was using the source version of 1.6, I was able to get actual useful exception messages. This issue is resolved.