ThinkGeo.com    |     Documentation    |     Premium Support

NauticalChartsFeatureLayer dependency exception

I am trying to create a nautical charts layer like so:
new NauticalChartsFeatureLayer(filePath)

but I get an exception: “The type initializer for ‘ThinkGeo.Core.GdalFeatureSource’ threw an exception”.
It’s a little strange, because looking at the InnerException’s InnerException property, it shows "Could not load file or assembly ‘ThinkGeo.Dependency.Gdal, Version=12.4.0.0, Culture=neutral, PublicKeyToken=0828af5241fb4207’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"
but the main message shows "Could not load file or assembly ‘ThinkGeo.Dependency.Gdal, Version=13.0.0.0, Culture=neutral, PublicKeyToken=0828af5241fb4207’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"

here’s a screenshot of the packages being used:
image and the csproj lines:





Is there some kind of version mismatch? I don’t have v12.4 referenced anywhere so I’m not sure why it’s showing that exception.

Looks like I’m getting the same error trying to create a NativeImageRasterLayer like so:

var bmpLayer = new NativeImageRasterLayer(filePath, new RectangleShape(-180, 90, 180, -90))
{
    LowerThreshold = GlobalObjects.Instance.OnyxMap.ZoomLevelSet.ZoomLevel13.Scale
};

bmpLayer.ImageSource.ProjectionConverter = new UnmanagedProjectionConverter(new Projection(4362).ProjString, new Projection(3857).ProjString);

hi @Dan_Weaver,

Package ThinkGeo.Dependency.Gdal 13 uses ThinkGeo.Dependency.Gdal.dll 12.4.0.0 actually, your exception information is correct.

Your code was working before, right? If so, could you try to recall what changes you made before seeing this exception?

I created a sample NauticalChartsFeatureLayerDependencyException.zip (1.2 MB) , but failed to reproduce the issue, could you try it or update it and see if you could reproduce the issue with this sample?

Regards,
Leo

Hello! thanks for the sample project. Turns out there was an old binding redirect in the app.config for that dll for some reason. removed and it works fine. thanks again!

Great! Let me know if you have other questions.

Regards,
Leo