ThinkGeo.com    |     Documentation    |     Premium Support

Exception: This function relies on MapSuiteDependency-Fdo.nupkg

I’ve been using the same code for awhile now, and all of the sudden I’m getting the error :

"System.Exception: This function relies on MapSuiteDependency-Fdo.nupkg. Please install this package first. 
Or this function is not support on Windows 
at ThinkGeo.MapSuite.UnmanagedAssembliesHelper.GetAssemblyPathFilename(String directoryName, String assemblyName, PclPlatform platform)  
at ThinkGeo.MapSuite.Layers.FdoVectorFeatureSource.OpenCore() 
at ThinkGeo.MapSuite.Layers.FeatureSource.Open()
at ThinkGeo.MapSuite.Layers.FeatureLayer.OpenCore()
at ThinkGeo.MapSuite.Layers.Layer.Open()  "

In particular, it’s when I try to open a PersonalGeoDatabaseFeatureLayer:

PersonalGeoDatabaseFeatureLayer personalGeoDatabaseFeatureLayer = new PersonalGeoDatabaseFeatureLayer(path, “FeatGUID”, null, tableName);

personalGeoDatabaseFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Green);
personalGeoDatabaseFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(100, GeoColor.SimpleColors.Green), 2, true);
personalGeoDatabaseFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimplePointStyle(PointSymbolType.Cross, GeoColor.SimpleColors.Green, 2);
personalGeoDatabaseFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
personalGeoDatabaseFeatureLayer.Open(); //This is where the error happens
Collection<Feature> features = personalGeoDatabaseFeatureLayer.FeatureSource.GetAllFeatures(ReturningColumnsType.AllColumns);
personalGeoDatabaseFeatureLayer.Close();

Now, I’ve had this package installed the whole time. Here’s a picture of my nuget tab:

and here’s a pic of the references:

Any ideas on what could be going wrong? I can confirm the filepath to my .mdb file is correct as well as the table name.

Hi Dan,

It looks the MapSuiteDependency-Fdo package hadn’t installed succeed.

I think you can try some ways like this to see whether that can works:

  1. Create a new project, install the full version which contains all of our packages, and then see whether your code can works: https://www.nuget.org/packages/MapSuiteDesktopForWpf-Standard/11.0.0-beta044

  2. If that works, please just remove all our packages from your currently project and do the operations as below:
    a. Delete bin & obj folder
    b. Delete packages folder
    c. Delete everything in folder %LocalAppData%\..\..\.nuget\packages
    d. Delete everything in folder %LocalAppData%\NuGet\Cache

  3. After clear everything, just reinstall the packages you need back and try whether it works.

  4. If that still don’t work, please sent us your simple sample which can reproduce it with a small data, we can help you look into that.

Regards,

Ethan

Thanks for the response. I tried deleting everything you said and reinstalling the packages but same issue. I made a new project with only the code trying to use the .mdb file. Here’s the error I got:

ERROR 1: Unable to initialize ODBC connection to DSN for DRIVER=Microsoft Access Driver (*.mdb);DBQ=D:\test\Data\test_2000.mdb,
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Exception thrown: ‘System.Reflection.TargetInvocationException’ in mscorlib.dll

So it looks like I’m missing some kind of driver or something which is strange because I haven’t changed anything between the time the code was working until now.

Update: The new test project I made works only if I target x86. 64bit gives me the above error. Changing the original program between x86 and x64 didn’t do anything. I reinstalled access db drivers, but same issue.

Hi Dan,

I build a simple sample based on your code, which can works well.

Could you please modify it and if possible attach a simple data in it, so we can reproduced your exception?

8899.zip (101.3 KB)

Regards,

Ethan

Okay, the project you attached works fine when I put in my filepath and tablename. However, it only works on “Any CPU” and “x86” (32 bit) for the target platform. When I change it to x64/64bit I get this error:

InnerException {“Connect failed: Unable to initialize ODBC connection to DSN for DRIVER=Microsoft Access Driver (*.mdb);DBQ=D:\test\Data\test_2000.mdb,\n[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified”} System.Exception {OSGeo.FDO.Common.Exception}

I’ve tried multiple .mdb files and it’s the same thing. I’ve done a little research and found something about needing to use teh 64bit ODBC driver or have it installed, which from what I can tell I do have installed.

This link might provide some info: https://stackoverflow.com/questions/13879789/x64-application-accessing-mdb-database

What connection string does the open function use in your code?

Update: I tried the solution listed here: https://trac.osgeo.org/gdal/ticket/5594 which is changing the name of a folder in the registry from *Microsoft Access Driver (*.mdb, .accdb) to Microsoft Access Driver (*.mdb, *.accdb). This let the program you gave run in 64bit, but not my program. The code is exactly the same. I stripped the rest of the code out of my program so it matched 100%, but I am still getting the original error from my first post.

Edit: Is there some place I can upload my whole project for you to check out?

Please download the test project at this link: https://1drv.ms/u/s!Aumr3sAYPp0bjAhX3b-a0Gf6FQ-n

It’s a WPF user control, hosted inside another WPF project (just a window). Please try it out and let me know if you get the error. Thanks!

Update: I tested multiple applications on different computers, both in winforms and wpf, both x86/x64/any cpu, and get the same error. Could it be a problem in the mapsuite MapSuiteDependency-Fdo package?

Hi Dan,

Thanks for your sample, I know why my sample cannot reproduce your issue.

And the first exception “This function relies on MapSuiteDependency-Fdo.nupkg” is because some dlls hadn’t been copied from the first project to the 2nd project, the two dlls are:
ThinkGeo.MapSuite.Wrappers.FdoX64.dll
ThinkGeo.MapSuite.Wrappers.FdoX86.dll

You can find that in the path like mine: packages\ThinkGeo.MapSuite.Layers.FdoVector.10.2.1\build\net45\Windows-X64\Fdo

They need to be copied to the same name folder under your bin folder.

That’s should be a bug, I have reported to our developers, but please manual copy them for now.

And for your 2nd exception:“Connect failed:…”

That’s because environment missing the component, I tried the Microsoft Access Database Engine 2016 Redistributable here: https://www.microsoft.com/en-us/download/details.aspx?id=54920

But it looks that still don’t work in our test machine, I guess the Virtual machine still have some problem, our developer will go on research that.

And I think you can tried to install the package also and see whether that works, because it’s an environment problem so test in your side is helpful.

Regards,

Ethan

Thanks for the response.

So for starters, it looks like I can connect to .mdb files okay. I am able to open them via code, get the table names, etc.

However, I’m still getting the main exception “This function relies on MapSuiteDependency-Fdo.nupkg” after manually copying over the .dlls you mentioned. Just to give some more debugging info on the error, at the stacktrace it says the error is at

" at ThinkGeo.MapSuite.UnmanagedAssembliesHelper.GetAssemblyPathFilename(String directoryName, String assemblyName, PclPlatform platform)\r\n at ThinkGeo.MapSuite.Layers.FdoVectorFeatureSource.OpenCore()\r\n at ThinkGeo.MapSuite.Layers.FeatureSource.Open()\r\n at ThinkGeo.MapSuite.Layers.FeatureLayer.OpenCore()\r\n at ThinkGeo.MapSuite.Layers.Layer.Open()\r\n "

Update: So this is pretty weird. I created a new project as the one you sent that works, made everything EXACTLY the same. I went file by file, line by line, including the solution file, etc. and made sure everything was the same. It worked fine. This was in VS 2015.

I made a new project in VS 2017, and did the same thing. I got the same error, but then I had it target .NET 4.5 instead of 4.5.2, and it seemingly worked, but I got thrown the same error. The layer.open() worked however.
After that, I narrowed it down to the error displaying only after I would make a change to one of the classes, even if it was just a space. The error would display before the program actually hit any of the code, but everything would run fine. Then it would display again after I exited the program. It only does this on the first debug after a change is made.

I have no idea what could be causing that and why it happened all of the sudden, but I suppose the code works for now!

Thanks for your help, let me know if you find anything else about it!

Hi Dan,

For VS2017, that’s should be a bug, I have reported to our developers.

The solution is manual copy all the dlls, they should be included in the folder Windows-X64 and Windows-X86.

You can find them in the bin folder of your first project “Onyx”, and you want to copy them to the second project “TestWindow”.

For example:
Copy from
Onyx\bin\Debug\Windows-X64 and Onyx\bin\Debug\Windows-X86
to
TestWindow\bin\Debug\Windows-X64 and TestWindow\bin\Debug\Windows-X86

I have a test application with VS2017 and compiled it with .net frameworks 4.5, please download and try to run it: https://ap.thinkgeo.com:5001/sharing/dETHcZZMZ .

Thanks,