deploying System.Data.SQLite.DLL

Topics: General
Jun 3, 2011 at 6:07 PM

When I tried the WindowsForm Demo I noticed that the cache was persistent; meaning if i quit the application lost my internet connection and re-opened the application I would be able to get map data. Right now I have incorporated GMaps into an app; however when I close the app, lose my internet connection and re-open it, all the tiles says "No data in local tile cache." To test, I changed the cacheLocation and I do get a folder structure like this \TileDBv3\en but there's no file in there, and if I right click TileDBv3 the size is 0 bytes. Am I doing something wrong? Do I need to set anything else up?

Jun 3, 2011 at 6:13 PM

Double check that you deploy System.Data.SQLite.DLL alongside the GMap dll's.

Jun 6, 2011 at 4:39 PM
Edited Jun 6, 2011 at 4:42 PM

It is properly listed under references; do I need to do something else?

The properties for this reference are as follows:

 

(Name): System.Data.SQLite
Aliases: global
Copy Local: true
Embed  Interop: False
Specific Versions: False

 

Coordinator
Jun 6, 2011 at 5:34 PM

new version requires to deploy two folders with sqlite, x64 and x86 as in demos

Jun 6, 2011 at 7:55 PM
Edited Jun 6, 2011 at 8:04 PM

Do I need to create the folders myself? I ask because I can't add two references with the same name, and I'm just wondering how to accomplish this as simply copying the folders x64 and x86 and their contents within the build folder does not work.

Coordinator
Jun 7, 2011 at 9:11 AM

yes it works, add two folders, add dlls, set build target to 'content', thats it.

Jun 7, 2011 at 1:09 PM

I tried doing what you suggested but still am unable to get data in the local cache. You can check my configuration by viewing the following image: http://dl.dropbox.com/u/6186580/Exception.png

I have checked, and after build it does copy the folder and dlls into the build folder but after closing the program and reopening without internet connectivity I get the No data in local tile cache. I would really appreciate any help you could give!

Jun 7, 2011 at 1:18 PM

When you are running with internet, do you have this somewhere in your code?

MapControl.Manager.Mode = GMap.NET.AccessMode.ServerAndCache;

Jun 7, 2011 at 1:37 PM

Yes I do. I have that in my map initialization, and then I do the check for internet connectivity with a try catch and if I don't have connectivity I change it to CacheOnly. 

Coordinator
Jun 7, 2011 at 1:44 PM

maybe thats the problem?

Jun 7, 2011 at 1:45 PM

How so? 

Coordinator
Jun 7, 2011 at 1:50 PM

did you tried debug?

Jun 7, 2011 at 1:53 PM

Yes....I have checked and when it runs it runs with Manager.Mode set to ServerAndCache. I also have a dropdown like the one you have in your demo to change the mode. If I change it to cache only while the application is running it works, but not after I close it

Coordinator
Jun 7, 2011 at 2:09 PM

are you sure you use AnyCPU target?

Jun 7, 2011 at 2:29 PM
Edited Jun 7, 2011 at 2:30 PM

I did not have it set to AnyCPU rather to x86. I have now changed that. When I debugged this time I noticed this exception in the output:

GetImageFromCache: System.DllNotFoundException: Unable to load DLL 'sqlite3': The specified module could not be found. 
(Exception from HRESULT: 0x8007007E)� �at Mono.Data.SqliteClient.Sqlite.sqlite3_open16(String dbname, IntPtr& handle)� �at Mono.Data.SqliteClient.SqliteConnection.Open()� �
at GMap.NET.CacheProviders.SQLitePureImageCache.GMap.NET.PureImageCache.GetImageFromCache(MapType type, GPoint pos, Int32 zoom)

Any ideas?

Coordinator
Jun 7, 2011 at 2:58 PM

so do you use mono version?

Jun 7, 2011 at 3:01 PM
Edited Jun 7, 2011 at 3:56 PM

I didn't mean to. Does this mean I have the wrong Gmap.NET.Core. and WindowsForms dll's?? How do I fix it then?

I tried  by deleting the references to the dlls I used, and used the ones I downloaded from Demo.WIndowsForms from your Downloads page, and now I don't get anything...all the tiles give the message that the Type Initializer for SingletonCreator threw an exception

Jun 7, 2011 at 6:10 PM

Please, any help you could provide would be very much appreciated as right now I can't use the app. I even created a new project using the references from GMap.WindowsForms and I get the same 

Type Initializer for SingletonCreator threw an exception
error on every tile. 

Jun 7, 2011 at 6:20 PM

I have gotten that exception before when using .NET 4.0.

Are you using .NET 4.0? If so, try putting this in your app.config file:

<?xml version="1.0"?>
<configuration>
   <startup useLegacyV2RuntimeActivationPolicy="true">
      <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
   </startup>
</configuration>

Jun 7, 2011 at 6:30 PM

Yes, my application already has that. At the time I noticed I was missing this, my app did not have an app.config file so I added a new application configuration file and copied this (which I saw in the downloads page) and pasted it. Unfortunately I still get the same error. I have attached teh debug trace to see if anything looks odd:

 

'WindowsFormsApplication1.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsFormsApplication1.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsFormsApplication1.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsFormsApplication1.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsFormsApplication1.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsFormsApplication1.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsFormsApplication1.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsFormsApplication1.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Documents and Settings\avivas\My Documents\Visual Studio 2010\Projects\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsFormsApplication1.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualBasic\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualBasic.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsFormsApplication1.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsFormsApplication1.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualBasic.PowerPacks.Vs\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualBasic.PowerPacks.Vs.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsFormsApplication1.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Messaging\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Messaging.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsFormsApplication1.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsFormsApplication1.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Data.DataSetExtensions\v4.0_4.0.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsFormsApplication1.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.CSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.CSharp.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsFormsApplication1.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsFormsApplication1.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Deployment\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Deployment.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsFormsApplication1.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The thread '' (0x16c) has exited with code 0 (0x0).
The thread 'vshost.LoadReference' (0x7ec) has exited with code 0 (0x0).
'WindowsFormsApplication1.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Documents and Settings\avivas\My Documents\Visual Studio 2010\Projects\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe', Symbols loaded.
'WindowsFormsApplication1.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Documents and Settings\avivas\My Documents\Visual Studio 2010\Projects\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\GMap.NET.WindowsForms.dll'
'WindowsFormsApplication1.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Documents and Settings\avivas\My Documents\Visual Studio 2010\Projects\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\GMap.NET.Core.dll'
'WindowsFormsApplication1.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsFormsApplication1.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Web.Services\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll'

Coordinator
Jun 8, 2011 at 6:35 AM
Edited Jun 8, 2011 at 6:36 AM

last log has zero value, please run debug mode with right dlls, with right config ;}

Jun 8, 2011 at 12:15 PM

I thought I did everything according to the documentation. I referenced the 3 dll's included in the GMap.NET.WindowsForms.zip  those being BSE.Windows.Forms.dll, GMap.Net.Core.dll, and GMap.Net.WindowsForms.dll. I then added the x86 and x64 folders to my project and set them as
"Content" and "Always Copy". Then I added the code mentioned by @mattgerg since I am using .NET 4.0 and this is what I get.

If there are any other changes I need to make, please do let me know!

 

Coordinator
Jun 8, 2011 at 12:28 PM

BSE.Windows.Forms.dll is not needed, and finally add reference to System.Data.SQLite.DLL, but set Copy Local to False

Jun 8, 2011 at 12:33 PM

For a Winforms project, I have never had to include BSE.Windows.Forms.dll.  I only use GMap.Net.Core.dll and GMap.Net.WindowsForms.dll.

Also, once the x86 and x64 folders are created, you need to put the appropriate SQLite dll inside each folder.  Look in the demo for an example of how to set that up in your project.

Jun 8, 2011 at 12:38 PM

Thanks @radioman and @mattgerg for all your help. This did the trick. Thanks for all your help!

Coordinator
Jun 8, 2011 at 12:49 PM

great ;} ..anyway in the next version deploying folders will be unnecessary and it will be done automatically, a little easier