# Error loading shapefile

**URL:** <https://community.thinkgeo.com/t/error-loading-shapefile/8556>\
**Category:** ThinkGeo General Questions\
**Created:** [May 16, 2017, 4:07pm UTC](https://community.thinkgeo.com/t/error-loading-shapefile/8556 "2017-05-16T16:07:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bruno](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/b/c77e96/32.png) [@Bruno](https://community.thinkgeo.com/u/Bruno)\
**Post date:** [May 16, 2017, 4:07pm UTC](https://community.thinkgeo.com/t/error-loading-shapefile/8556/1 "2017-05-16T16:07:23Z")

</div>

Hi,

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

> System.IO.FileLoadException  
> 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(IEnumerable`1 returningColumnNames) at ThinkGeo.MapSuite.Core.FeatureSource.<GetAllFeatures>b__d(IEnumerable`1 cns)  
> at ThinkGeo.MapSuite.Core.FeatureSource.eBQ=(IEnumerable`1 returningColumnNames, Func`2 getFeatures, IEnumerable`1 filters) at ThinkGeo.MapSuite.Core.FeatureSource.GetAllFeatures(IEnumerable`1 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:

[https://wetransfer.com/downloads/227c23a261ef661231fa3be57ec664b820170516160812/75f2ebc692e845f3a163da1bac83f65020170516160812/4e00ff](https://wetransfer.com/downloads/227c23a261ef661231fa3be57ec664b820170516160812/75f2ebc692e845f3a163da1bac83f65020170516160812/4e00ff)

Best regards,  
BdaF

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [May 17, 2017, 7:27am UTC](https://community.thinkgeo.com/t/error-loading-shapefile/8556/2 "2017-05-17T07:27:08Z")

</div>

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.

Regards,

Don

---

<div class="post-metadata">

**Author:** ![Bruno](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/b/c77e96/32.png) [@Bruno](https://community.thinkgeo.com/u/Bruno)\
**Post date:** [May 17, 2017, 9:11am UTC](https://community.thinkgeo.com/t/error-loading-shapefile/8556/3 "2017-05-17T09:11:27Z")

</div>

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,  
BdaF

---

<div class="post-metadata">

**Author:** ![Bruno](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/b/c77e96/32.png) [@Bruno](https://community.thinkgeo.com/u/Bruno)\
**Post date:** [May 17, 2017, 9:15am UTC](https://community.thinkgeo.com/t/error-loading-shapefile/8556/4 "2017-05-17T09:15:40Z")

</div>

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,  
BdaF

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [May 18, 2017, 3:01am UTC](https://community.thinkgeo.com/t/error-loading-shapefile/8556/5 "2017-05-18T03:01:58Z")

</div>

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 Resolved.zip](https://community.thinkgeo.com/uploads/default/original/3X/0/2/02c257ffcaed103c4de8c18922b999616c60077a.zip) (5.5 KB)

Regards,

Don
