|     Blog    |     Wiki    |     Support

Error loading shapefile


We’re trying to load a shapefile into memory using class “ShapeFileFeatureSource” but it throws an exception with the following message/stacktrace:

The record is invalid, please call Validate method to check the failed reason.Record index: 48
at ThinkGeo.MapSuite.Core.ShapeFile.sBQ=(Int32 recordIndex)
at ThinkGeo.MapSuite.Core.ShapeFileFeatureSource.GetAllFeaturesCore(IEnumerable1 returningColumnNames) at ThinkGeo.MapSuite.Core.FeatureSource.<GetAllFeatures>b__d(IEnumerable1 cns)
at ThinkGeo.MapSuite.Core.FeatureSource.eBQ=(IEnumerable1 returningColumnNames, Func2 getFeatures, IEnumerable1 filters) at ThinkGeo.MapSuite.Core.FeatureSource.GetAllFeatures(IEnumerable1 returningColumnNames)
at ThinkGeo.MapSuite.Core.FeatureSource.GetAllFeatures(ReturningColumnsType returningColumnNamesType)

There’s some problem with shapefile data and we don’t understand what is it.

We’ve uploaded a Visual Studio project into WeTransfer service with which you can replicate this problem. You can download it with the following link:

Best regards,

Hi BdaF,

If the sample is small you can directly upload it here, if that’s big you can choose to sent us via our FTP.

This exception is because your 48 and 49 record is invalid, we improve related logic so it will skip invalid records, we tried some other utility which also skip invalid records.

Please get our latest code to have a try.

For V9 it’s 9.0.694.0 or higher version
For V10 it’s ThinkGeo MapSuite ShapeFile Layer 11.0.0-beta002 or higher version

We will refresh the download link in one or two days, please keep you eyes on it.



Hi Don,

What do you mean by “(…) we improve related logic so it will skip invalid records, we tried some other utility which also skip invalid records (…)”? Does that mean that the features will not be loaded into memory or it will have a null geometry?

We are using V9 and we must keep it. Those TG 9.0 versions are beta or release versions? Some time ago we used a BETA version and it was really unstable. We cannot afford to use unstable versions on our software solutions.

Best regards,

BTW Ron,

Can you explain the reason why is this happening?

We open this shapefile on QGIS and perform “Geometry Validation Check” over it and it doesn’t detect any problem.

For now, we want to know the problem and solve it with some spatial tool or other methodology. We don’t want to replace TG DLL versions.

Best regards,

Hi BadF,

Your record 48 and record 49 is invalid both in shp and dbf file, the other spatial tool for example QGis and GlobalMapper just ignore the invalid record, so you cannot validate that.

We help you remove the invalid record in the file attached, you can use it directly no need to replace dll, wish it’s helpful.

Issue ShapeFile (5.5 KB)