GMap.NET icon indicating copy to clipboard operation
GMap.NET copied to clipboard

Cannot Create an instance of GMapControl - WPF Application Error

Open SaiBalaji202 opened this issue 6 years ago • 10 comments

When I try to add GMapControl to my WPF Application, I'm getting an error saying "Cannot Create an instance of GMapControl" I'm also getting the following error message Unable to load DLL 'SQLite.Interop.dll': The specified module could not be found.

How to solve this issue? I want to use GMap in my WPF application Capture

SaiBalaji202 avatar Jul 11 '19 18:07 SaiBalaji202

Hallo, install with nuget the "System.Data.SQLite.Core" check the "bin" directory in the directories "x86" and "x64" which contains dll "SQLite.Interop.dll". This should happen when deploying the application.

KlaLeu avatar Jul 13 '19 14:07 KlaLeu

Hi, At the time of installing GMap itself, SQLite.Core also gets installed. I also checked 'x86' and 'x64' directories. They also contain the SQLite.Interop.dll

Still, I'm getting the same error. Could you please help me with that?

SaiBalaji202 avatar Jul 13 '19 15:07 SaiBalaji202

Same problem. Any solution would be appriciated!

xxJohnxx avatar Jul 15 '19 22:07 xxJohnxx

Hi, I had this error synonymous and by downloading and integration of the nuget package has it works for me then. I once attached a minimal test project. I hope that helps solve the problem.

GMapTestCSharpMin.zip

KlaLeu avatar Jul 16 '19 06:07 KlaLeu

Hi KlaLeu, Thanks for the example project! However, it is in WinForms, which works well on my end.

I get the SQLite.Interop.dll error when using WPF (Windows Presentation Foundation). Same for SaiBalaji202 as it seems according to his first post.

Do you have any experience with that, regarding the specific problem?

xxJohnxx avatar Jul 16 '19 21:07 xxJohnxx

Hi KlaLeu, Please try for WPF project and Update.

VISHAL1204 avatar Jul 18 '19 05:07 VISHAL1204

Hi, The problem also exists with the master downloaded here. It seems that there is a problem with the MapControl in the WPF Designer. This can be avoided by building the WPF form exclusively in xaml. I did that in the attached mini project and it works. WPFErrorInDemo TestWPF_GMapMin.zip

Sorry, I have no experience in WPF because I work exclusively in the Windows Forms area and .Net Microframework https://kleuthold.wordpress.com/ area.

KlaLeu avatar Jul 20 '19 10:07 KlaLeu

I solved this issue by by changing the build from Any CPU to x64.

JustABearOz avatar Jul 29 '19 06:07 JustABearOz

+1

I just realized this project was still maintained (was using the radioman github stuck at 1.7.5) so I decided to update our project to the latest release.

Seems like application targeting .NET4 and Any CPU have a problem with loading SQLite dll. Switching my application to x64 works, but I would really like to prevent forcing a x64 OS and keep "Any CPU" functional. Any idea how we could fix that?

Edit: Nevermind, Adding the System.Data.SQLite nuget in my project fixed it. It downloaded both x86 and x64 dll in different folders and it seems to be working.

Dunge avatar Mar 19 '20 21:03 Dunge

Please try to add this line to your csproj: <RuntimeIdentifier>win-x86</RuntimeIdentifier>

For me it works with AnyCPU Prefer 32bit=True, .NET 4.0 target

zgabi avatar Mar 19 '20 22:03 zgabi