judero01col / GMap.NET

GMap.NET Windows Forms & Presentation is an excellent open source, powerful, free and cross-platform .NET control. Allows the use of routing, geocoding, directions and maps from Google, Yahoo!, Bing, OpenStreetMap, ArcGIS, Pergo, SigPac, Yendux, Mapy.cz, Maps.lt, iKarte.lv, NearMap, HereMap, CloudMade, WikiMapia, MapQuest and many more.
Other
443 stars 197 forks source link

Gmap.NET MacOS crash while initializing #148

Open iglaweb opened 2 years ago

iglaweb commented 2 years ago

MacOS Catalina 10.15.7. Attempted launching in Visual Studio and JB Rider – same outcome.

Exception is thrown on line this.mapMain = new GMap.NET.WindowsForms.GMapControl();

As far as I see, GMap control crashed in FastResourceLock.cs, CreateSemaphore and invokes native methods placed in kernel32.dll (see here). This dll library does not exist in MacOS. Seems, GMap did not add an implementation specific for MacOS and that's why it throws exception and works seamlessly on Windows.

Unhandled Exception: System.TypeInitializationException: The type initializer for 'GMap.NET.WindowsForms.GMapControl' threw an exception. ---> System.TypeInitializationException: The type initializer for 'GMap.NET.GMaps' threw an exception. ---> System.EntryPointNotFoundException: CreateSemaphore assembly: type: member:(null) at (wrapper managed-to-native) GMap.NET.Internals.NativeMethods.CreateSemaphore(intptr,int,int,string) at GMap.NET.Internals.FastResourceLock..ctor () [0x0000d] in <68b0897c8ab945d88a0abb7a955b733e>:0 at GMap.NET.Internals.FastReaderWriterLock..ctor () [0x00024] in <68b0897c8ab945d88a0abb7a955b733e>:0 at GMap.NET.CacheProviders.MemoryCache..ctor () [0x0000b] in <68b0897c8ab945d88a0abb7a955b733e>:0 at GMap.NET.GMaps..ctor () [0x00031] in <68b0897c8ab945d88a0abb7a955b733e>:0 at GMap.NET.GMaps..cctor () [0x00000] in <68b0897c8ab945d88a0abb7a955b733e>:0 --- End of inner exception stack trace --- at GMap.NET.WindowsForms.GMapControl..cctor () [0x00023] in :0 --- End of inner exception stack trace --- at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr) at SS_Server_Demo.MainForm.InitializeComponent () [0x00001] in <70df01ca8abb46d08ed4abffff633010>:0 at SS_Server_Demo.MainForm..ctor () [0x0000f] in <70df01ca8abb46d08ed4abffff633010>:0 at (wrapper remoting-invoke-with-check) SS_Server_Demo.MainForm..ctor() at SS_Server_Demo.Program.Main () [0x0000e] in <70df01ca8abb46d08ed4abffff633010>:0 [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'GMap.NET.WindowsForms.GMapControl' threw an exception. ---> System.TypeInitializationException: The type initializer for 'GMap.NET.GMaps' threw an exception. ---> System.EntryPointNotFoundException: CreateSemaphore assembly: type: member:(null) at (wrapper managed-to-native) GMap.NET.Internals.NativeMethods.CreateSemaphore(intptr,int,int,string) at GMap.NET.Internals.FastResourceLock..ctor () [0x0000d] in <68b0897c8ab945d88a0abb7a955b733e>:0 at GMap.NET.Internals.FastReaderWriterLock..ctor () [0x00024] in <68b0897c8ab945d88a0abb7a955b733e>:0 at GMap.NET.CacheProviders.MemoryCache..ctor () [0x0000b] in <68b0897c8ab945d88a0abb7a955b733e>:0 at GMap.NET.GMaps..ctor () [0x00031] in <68b0897c8ab945d88a0abb7a955b733e>:0 at GMap.NET.GMaps..cctor () [0x00000] in <68b0897c8ab945d88a0abb7a955b733e>:0 --- End of inner exception stack trace --- at GMap.NET.WindowsForms.GMapControl..cctor () [0x00023] in :0

hellcoderGIT commented 2 years ago

I don't think GMap.NET.WindowsForms was ever intended to work cross-platform, but even the core package doesn't work cross-platform anymore (see the issue created before yours).