ThinkGeo.com    |     Documentation    |     Premium Support

V14.3.0 - ESRI FileGeoDatabase - Exception with GetAllFeatures

ThinkGeo Team,

An exception occurs from GetAllFeatures.

Same code & data runs under V12.1.0 without issue.

Thanks,
Dennis

Code leading to the exception:

GetAllFeatures(ReturningColumnsType.AllColumns, 0, 1);

and

cAllFeatures = oDatabaseTableItem.FeatureSource.GetAllFeatures(ReturningColumnsType.AllColumns, 0, 9000);
2025-03-13 15:01:18,723 ERROR OriStarFileDatabaseViewer - OriStarFileDatabaseViewer->GeneralMethods.PopulateDatabaseCollectionGdb:
Unable to GetAllFeatures
TableName=\pole_locations__ATTACH
FileGeoDatabaseFeatureLayer(C:\OriStar\xxxx\OriStarVisionMapSuite\MapGeoDatabase\OEMC_LightPole.gdb)
Source=Esri.FileGDBAPI
TargetSite=Void Init()
StackTrace=   at Esri.FileGDB.RowCollectionEnumerator.Init()
   at System.Linq.Enumerable.EnumerablePartition`1.MoveNext()
   at GRU=.R0I=.XkI=(IEnumerable`1 returningColumnNames, Int32 startIndex, Int32 takeCount)
   at ThinkGeo.Core.FileGeoDatabaseFeatureSource.GetAllFeaturesCore(IEnumerable`1 returningColumnNames, Int32 startIndex, Int32 takeCount)
   at ThinkGeo.Core.FeatureSource.GetAllFeatures(IEnumerable`1 returningColumnNames, Int32 startIndex, Int32 takeCount)
   at ThinkGeo.Core.FeatureSource.GetAllFeatures(ReturningColumnsType returningColumnTypes, Int32 startIndex, Int32 takeCount)
   at OriStarFileDatabaseViewer.GeneralMethods.PopulateDatabaseCollectionGdb(String TheFile, String TheFilePath, String TheFileName, String TheFileTypeUpCase) in C:\OriStarMappingIncThinkGeoUI-V14.3.0Secondary\OriStarFileDatabaseViewer\TheGeneralMethods.cs:line 558
Message=An expected Field was not found or could not be retrieved properly.
Esri.FileGDB.FileGDBException: An expected Field was not found or could not be retrieved properly.
   at Esri.FileGDB.RowCollectionEnumerator.Init()
   at System.Linq.Enumerable.EnumerablePartition`1.MoveNext()
   at GRU=.R0I=.XkI=(IEnumerable`1 returningColumnNames, Int32 startIndex, Int32 takeCount)
   at ThinkGeo.Core.FileGeoDatabaseFeatureSource.GetAllFeaturesCore(IEnumerable`1 returningColumnNames, Int32 startIndex, Int32 takeCount)
   at ThinkGeo.Core.FeatureSource.GetAllFeatures(IEnumerable`1 returningColumnNames, Int32 startIndex, Int32 takeCount)
   at ThinkGeo.Core.FeatureSource.GetAllFeatures(ReturningColumnsType returningColumnTypes, Int32 startIndex, Int32 takeCount)
   at OriStarFileDatabaseViewer.GeneralMethods.PopulateDatabaseCollectionGdb(String TheFile, String TheFilePath, String TheFileName, String TheFileTypeUpCase) in C:\OriStarMappingIncThinkGeoUI-V14.3.0Secondary\OriStarFileDatabaseViewer\TheGeneralMethods.cs:line 558



2025-03-13 15:25:03,204 ERROR OriStarFileDatabaseViewer - OriStarFileDatabaseViewer->DatabaseTableFeatureData.LoadDatabaseTableFeatureDataCollection:
Unable to GetAllFeatures
TableName=WATER
Source=ThinkGeo.FileGeoDatabase
TargetSite=ThinkGeo.Core.Feature b0I=(System.Collections.Generic.IEnumerable`1[System.String], Esri.FileGDB.Row)
StackTrace=   at GRU=.R0I=.b0I=(IEnumerable`1 returningColumnNames, Row row)
   at GRU=.R0I=.XkI=(IEnumerable`1 returningColumnNames, Int32 startIndex, Int32 takeCount)
   at ThinkGeo.Core.FileGeoDatabaseFeatureSource.GetAllFeaturesCore(IEnumerable`1 returningColumnNames, Int32 startIndex, Int32 takeCount)
   at ThinkGeo.Core.FeatureSource.GetAllFeatures(IEnumerable`1 returningColumnNames, Int32 startIndex, Int32 takeCount)
   at ThinkGeo.Core.FeatureSource.GetAllFeatures(ReturningColumnsType returningColumnTypes, Int32 startIndex, Int32 takeCount)
   at OriStarFileDatabaseViewer.DatabaseTableFeatureData.LoadDatabaseTableFeatureDataCollection(clsDatabaseTableItem& oDatabaseTableItem) in C:\OriStarMappingIncThinkGeoUI-V14.3.0Secondary\OriStarFileDatabaseViewer\cfDatabaseTableFeatureData.cs:line 321
Message=General function failure.
Esri.FileGDB.FileGDBException: General function failure.
   at GRU=.R0I=.b0I=(IEnumerable`1 returningColumnNames, Row row)
   at GRU=.R0I=.XkI=(IEnumerable`1 returningColumnNames, Int32 startIndex, Int32 takeCount)
   at ThinkGeo.Core.FileGeoDatabaseFeatureSource.GetAllFeaturesCore(IEnumerable`1 returningColumnNames, Int32 startIndex, Int32 takeCount)
   at ThinkGeo.Core.FeatureSource.GetAllFeatures(IEnumerable`1 returningColumnNames, Int32 startIndex, Int32 takeCount)
   at ThinkGeo.Core.FeatureSource.GetAllFeatures(ReturningColumnsType returningColumnTypes, Int32 startIndex, Int32 takeCount)
   at OriStarFileDatabaseViewer.DatabaseTableFeatureData.LoadDatabaseTableFeatureDataCollection(clsDatabaseTableItem& oDatabaseTableItem) in C:\OriStarMappingIncThinkGeoUI-V14.3.0Secondary\OriStarFileDatabaseViewer\cfDatabaseTableFeatureData.cs:line 321

Hi Dennis,

Please check out my reply at V14.3.0 - ESRI FileGeoDatabase - Exception if ActiveLayer Not Set - ThinkGeo UI for Desktop / WPF - ThinkGeo Discussion Forums. It shows how to use the old way to open a FileGeodatabase in v14.

This GetAllFeatures issue cannot be recreated using our test data, can you send over your test data to us?

Thanks,
Ben

Hi Dennis,

I recreated this issue when opening pole_locations_ATTACH table within OEMC_LightPole.gdb you sent over. It’s because that table doesn’t have any Geometry data, open that gdb in QGIS and you will see it like following:

image

To fix it, I throw an “The table does not contain a geometry column.” exception in Open() if the current table doesn’t have any geometry data. The changes is available in the latest beta098.

Just FYI, I loop through all the other tables in the 2 test databases you sent over and they all work fine.

Thanks,
Ben

Thanks Ben. I’ll update to the latest and let you know.

Dennis

Just let me know what you find out.

hi Ben,

Prior to this change at least I could open the layer and get the WellKnownType and Columns. With this exception one can’t do anything.

Other FeatureLayer (shape, sqlite) have a property named IsGeometryValid. It would be nice to have this property for FileGeoDatabase.

I think it should be Opened and GetAllFeatures return all features. And then if it is attempted to be used in the map then an exception might be appropriate.

Thanks,
Dennis

Hi Dennis,

Make sense! I made the changes accordingly and now the same table returns the following result:

  // not throwing exception
  fileGeoDatabaseFeatureLayer.Open(); 

  // returns 6 columns which doesn't include geometry. 
  var columns = fileGeoDatabaseFeatureLayer.FeatureSource.GetColumns(); 

  // count is 0, because no records in that table
  var count = fileGeoDatabaseFeatureLayer.FeatureSource.GetCount();

  // returns Invalid
  var featureType = fileGeoDatabaseFeatureLayer.FeatureSource.GetFirstFeaturesWellKnownType();

Pull the latest beta100 and have a try.

Thanks,
Ben

hi Ben,

Works great. Now the layer can be ‘seen’ and reported as to the problem with the layer.

Thanks,
Dennis

That’s Great, Dennis!