|     Blog    |     Wiki    |     Support

Bing Maps crash when applying a projection

Upgraded an application that was using VS 2012 and version 9.0 of Think Geo. This all worked as expected.

Now using VS 2017 and ThinkGeo 10.5, but had to load the bare bones, and only the needed packages (there were conflicts when using the core (npgsql as our app uses the latest for the entity framework)).

The map itself is in a selected projection (in this case, it is UTM Zone 12, epsg 26712), and I need to convert the bing map to that projection.

I use this to set the projection:

        if (_mapImageProjection == null)
            _mapImageProjection = new Proj4Projection();
        _mapImageProjection.InternalProjectionParametersString = Proj4Projection.GetBingMapParametersString();
        _mapImageProjection.ExternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(srid);

        // Layer is the BingMapsLayer that I need to adjust the projection on
        layer.ProjectionFromSphericalMercator = _mapImageProjection;

When I run this, and it renders the bing layer I get a crash that states:

Unhandled Exception
Message=The type initializer for ‘kCY=.nUk=’ threw an exception.
at ThinkGeo.MapSuite.Wpf.Tile.DrawException(GeoCanvas geoCanvas, Exception exception)
at ThinkGeo.MapSuite.Wpf.Tile.Draw(GeoCanvas geoCanvas)
at ThinkGeo.MapSuite.Wpf.Tile.4Fk=(Object status)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()

Inner Exception 1:
InvalidOperationException: This function relies on MapSuiteDependency-UnmanagedProj4Projection.nupkg. Please install this package first. Or this function is not support on Windows

There must be some missing packages as I get a crash (with limited info) when displaying a Bing Map overlay. I have added ThinkGeo.MapSuite.Shapes.UnmanagedProj4Projection which added MapSuiteDependency-UnmanagedProj4Projection (this seems to be the missing dependency?), I have also ensured that MapSuiteDependency-MicrosorfVisualCRunTime100 is also present. I have also manually made sure that all of these respective .dll files are present in the executable directory as well, but none of this seems to help.

If I remove the assignment to the BingMaps layer.ProjectionFromSphericalMercator, I see the Bing map, but it is, of course not in the right place.

Any hints as to which packages, and or .dll’s might be the case.

I am going to review the reason we couldn’t use the core package, might just confirm that a missing package is the culprit.

Hi Chris,

Yes you should want to install the package “ThinkGeo.MapSuite.Shapes.UnmanagedProj4Projection” manual.

I build a simple sample and it looks the bing map works well, you can compare the sample and see where is the different. (101.6 KB)

Wish that’s helpful.