"Specified cast is not valid" error is table_hgbst_show.last_mod_time is NULL (Article # 257)
View products that this article applies to.
Problem:
If table_hgbst_show.last_mod_time is NULL, then fcSDK and DataVerifier both throw an error:
"Specified cast is not valid"
stack trace:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidCastException: Specified cast is not valid.
at FChoice.Foundation.Clarify.DataObjects.HierarchicalStringShow..ctor(Int32 A_0, DataRow A_1)
at FChoice.Foundation.Clarify.DataObjects.HierarchicalStringElement..ctor(Int32 A_0, DataRow A_1)
at FChoice.Foundation.Clarify.DataObjects.HierarchicalStringElementCollection.CreateDataObject(DataRow row)
at FChoice.Foundation.DataObjects.DataObjectCollection.Initialize(DataRow[] rows)
at FChoice.Foundation.Clarify.DataObjects.HierarchicalStringElementCollection..ctor(Int32 A_0, DataRow[] A_1)
at FChoice.Foundation.Clarify.DataObjects.HierarchicalStringShow..ctor(Int32 A_0, DataRow A_1)
at FChoice.Foundation.Clarify.DataObjects.HierarchicalStringList..ctor(DataRow A_0)
at FChoice.Foundation.Clarify.DataObjects.HierarchicalStringListCollection.CreateDataObject(DataRow row)
at FChoice.Foundation.DataObjects.DataObjectCollection.Initialize(DataTable table)
at FChoice.Foundation.Clarify.DataObjects.HierarchicalStringListCollection..ctor(DataTable A_0)
at FChoice.Foundation.Clarify.ListCache.LoadCacheData(Object cacheData)
at FChoice.Foundation.CacheBase.b()
at FChoice.Foundation.CacheManager.a(CacheBase[] A_0)
at FChoice.Foundation.CacheManager.a(CacheBase[] A_0, ISchemaCache A_1)
at FChoice.Foundation.FCApplication.FCAppInitialize(CacheBase[] caches, ISchemaCache schemaMaster)
at FChoice.Foundation.Clarify.ClarifyApplication.InitializeInternal(NameValueCollection configValues, CacheBase[] caches, ISchemaCache schemaMaster)
at FChoice.Foundation.Clarify.ClarifyApplication.Initialize(NameValueCollection configValues)
at FChoice.Foundation.Clarify.Compatibility.FCApplication.Initialize()
Resolution:
There is an open CR for fcSDK to handle this situation better.
In the meantime, you can identify this situation with the following query:
select * from table_hgbst_show where last_mod_time is null
If any of those records have last_mod_time set to NULL, you can update them to be 1/1/1753 using SQL:
update table_hgbst_show set last_mod_time = '1/1/1753 00:00:00' where last_mod_time is null
Applies To:
-
Dovetail SDK – Dovetail Software Development Kit for Clarify