I have a date from a database as shown in the image below.
However when I convert this value to a DateTime
-instance I get the error shown below.
However when running the code I get an InvalidCastException
that the returned value cannot be cast to DateTime
.
I am using VS2010 on .Net3.5 that´s why I wonder why this library is needed at all.
Within a referenced assembly I´m using IronPython which uses DLR as far as I know. On .Net 3.5 I can use this however when referencing Microsoft.Scripting and Microsoft.Scripting.Core also. I suppose this causes the error in any way. Weird on this is that the code that uses IronPython is not called at all when executing the code producing that exception.
EDIT: For those who can´t believe: the same code works some time querying some rows from the database and returning correct dates. However at one point it throws that exception.
Further EDIT: As you can see on first image row.GetValue
returns a dynamic
which is strange as the assembly (ArcGIS 10.2 for Desktop) where this code is implemented is also written using .Net 3.5. Furthermore when I go to the definition of that type I get object get_Value(int Index);
instead of dynamic
.