FileGeodatabase API v1.1 via .NET wrapper:
All Date fields from any File Geodatabase come out subtracting a month from the date. For example:
The date 6/20/2007 8:59:22 AM will be returned as 5/20/2007 8:59:22 AM
Additionally, dates such as 7/31/2007 8:59:22 AM being converted to an impossible 6/31/2007 8:59:22 AM, or any date in January will return a "A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll. General exception. Year, Month, and Day parameters describe an un-representable DateTime."
I am assuming this to be a bug in the .NET wrapper for the 1.1 API - I've confirmed this is only occurring in the .NET wrapper. The date field returns correctly when operating only within the C++ API without the .NET wrapper. Additionally confirmed this error occurs with both the x86 and x64 compiled binaries for the .NET wrapper for the API.
Stack Trace:
at System.DateTime.DateToTicks(Int32 year, Int32 month, Int32 day)
at Esri.FileGDB.Row.GetDate(String field) in f:\filegdb_api\src\esri.filegdbapi\row.cpp:line 190
at Esri.FileGDB.Row.get_Item(String field) in f:\filegdb_api\src\esri.filegdbapi\row.cpp:line 390
at MyProject.MainWindow.SelectAllColumns() in C:\pathtoproject\MyProject\MainWindow.xaml.cs:line 239
Currently, I can convert dates I can read and unfortunately just swallow errors for dates that cause an issue:
try
{
data = row.GetDate(fieldName);
//bug in 1.1 API in .NET wrapper
data = ((DateTime)data).AddMonths(1);
}
catch (SystemException ex)
{
Trace.WriteLine(ex);
}
Any ideas for a workaround or how best to potentially log this as a bug? Thanks.