AnsweredAssumed Answered

Exception from a shapefile whose .dbf contains a "Date" field

Question asked by MrWlodek on Jun 13, 2015
Latest reply on Jan 21, 2016 by akajanus-esristaff

Hi,

I just encountered strange behaviour when trying to use a ShapefileTable from a shapefile that has at least one field of type "Date" among the attributes in its .dbf file. Any attempt to either get a count of the features or to iterate over the features ends in an exception:

 

"The added or subtracted value results in an un-representable DateTime. Parameter name: t"

 

Steps to reproduce:

 

Use any shapefile with at least one attribute of type "Date", with actual dates in the data, and then:

 

var shapefileTable = await ShapefileTable.OpenAsync(fileName);

var features = await shapefileTable.QueryAsync(new QueryFilter() { WhereClause = "1=1" });

if (features == null || features.Count() == 0)

{

    // e.g. throw an exception

}

 

The relevant stack trace:

 

   at System.DateTime.op_Addition(DateTime d, TimeSpan t)

   at Esri.ArcGISRuntime.Internal.DateUtils.FromMillisecondsSinceEpoch(Int64 milliSeconds)

   at Esri.ArcGISRuntime.Data.ArcGISFeatureTable.RowEnumerator.<System.Collections.Generic.IEnumerable<Esri.ArcGISRuntime.Data.GeodatabaseFeature>.GetEnumerator>d__48.MoveNext()

   at Esri.ArcGISRuntime.Data.ArcGISFeatureTable.RowEnumerator.<System.Collections.Generic.IEnumerable<Esri.ArcGISRuntime.Data.Feature>.GetEnumerator>d__4e.MoveNext()

   at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)

 

I would appreciate if this was acknowledged as an issue and fixed as soon as possible.

 

Thanks, regards.

Outcomes