Upgrades Questions on upgrading to version 6.x.
Version 6.x > Upgrades > Error updating - Failed to create new object of class 'CMS.Document': String was not recognized as a valid DateTime. View modes: 
User avatar
Member
Member
ramon.almarza-emtmadrid - 2/27/2013 10:31:20 AM
   
Error updating - Failed to create new object of class 'CMS.Document': String was not recognized as a valid DateTime.
Hello,

We are updating our KenticoCMS version from 5.5R2 to 6.0. The update process has been completed aparently without problems. We access to CMSDesk and we can view the content tree perfecly, but when we try to expand a node, occurs next error:
"Failed to create new object of class 'CMS.Document': String was not recognized as a valid DateTime."

We don´t know what could be the problem. Please, could you help us?

Thanks in advance.

User avatar
Member
Member
ramon.almarza-emtmadrid - 2/27/2013 11:03:15 AM
   
RE:Error updating - Failed to create new object of class 'CMS.Document': String was not recognized as a valid DateTime.
Maybe it could bu usefull the stack trace:
[FormatException: String was not recognized as a valid DateTime.]
System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +3623622
System.Convert.ToDateTime(String value, IFormatProvider provider) +72
System.String.System.IConvertible.ToDateTime(IFormatProvider provider) +10
System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) +9509239
CMS.DataEngine.SimpleDataClass.SetData(Int32 columnIndex, Object value) +192
CMS.DataEngine.SimpleDataClass.LoadDataRow(DataRow dr) +145
CMS.DataEngine.SimpleDataClass.RunNew(String className, DataRow dataRowObject) +89

[Exception: Failed to create new object of class 'CMS.Document': String was not recognized as a valid DateTime.]
CMS.DataEngine.SimpleDataClass.RunNew(String className, DataRow dataRowObject) +181
CMS.TreeEngine.TreeNode.NewInstanceFromDataRow(DataRow dataRow, String className, TreeProvider existingTreeProvider) +119
CMS.WorkflowEngine.ContentDocument.New(DataRow dataRow, String className, TreeProvider treeProvider) +118
CMS.WorkflowEngine.DocumentHelper.NewDocument(DataRow dataRow, String className, TreeProvider treeProvider) +9
CMS.TreeEngine.TreeNode.New(DataRow dataRow, String className, TreeProvider treeProvider) +114
CMS.TreeEngine.TreeProvider.SelectSingleNode(String siteName, String aliasPath, String cultureCode, Boolean combineWithDefaultCulture, String className, Boolean selectOnlyPublished, Boolean checkPermissions, Boolean selectCoupledData) +1524
CMS.TreeEngine.TreeProvider.SelectSingleNode(Int32 nodeId, String cultureCode, Boolean combineWithDefaultCulture, Boolean coupledData) +812
CMS.TreeEngine.TreeProvider.SelectSingleNode(Int32 nodeId, String cultureCode, Boolean combineWithDefaultCulture, Boolean coupledData) +47
CMS.TreeEngine.TreeProvider.SelectSingleNode(Int32 nodeId, String cultureCode, Boolean combineWithDefaultCulture) +19
CMS.TreeEngine.TreeProvider.SelectSingleNode(Int32 nodeId, String cultureCode) +34
CMSModules_Content_CMSDesk_New_NewCultureVersion.Page_Load(Object sender, EventArgs e) +774
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Control.OnLoad(EventArgs e) +91
CMS.UIControls.CMSPage.OnLoad(EventArgs e) +64
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 3/1/2013 10:53:40 AM
   
RE:Error updating - Failed to create new object of class 'CMS.Document': String was not recognized as a valid DateTime.
Hi,

just updating this post according to our e-mail conversation. Refreshing the views should help, you need to be sure you have correct permissions to do so:
/*Refresh all views*/


DECLARE @statusCursor CURSOR;

SET @statusCursor = CURSOR FOR SELECT name FROM sysobjects WHERE OBJECTPROPERTY(id, N'IsView') = 1 AND category = 0;



DECLARE @viewName nvarchar(450);

DECLARE @viewSchema nvarchar(450);

OPEN @statusCursor

FETCH NEXT FROM @statusCursor INTO @viewName;

WHILE @@FETCH_STATUS = 0

BEGIN

SET @viewSchema = (select TOP 1 TABLE_SCHEMA from information_schema.views WHERE TABLE_NAME = @viewName)

SET @viewName = @viewSchema + '.' + @viewName;

EXECUTE sp_refreshview @viewName;

FETCH NEXT FROM @statusCursor INTO @viewName;

END

CLOSE @statusCursor;

DEALLOCATE @statusCursor;

GO

Best regards,
Juraj Ondrus

User avatar
Member
Member
Raymond A - 5/7/2013 11:33:36 AM
   
RE:Error updating - Failed to create new object of class 'CMS.Document': String was not recognized as a valid DateTime.
Thanks , for the script above.
Im also facing the same issue and did run the script. The script run with the following error returned:
Msg 206, Level 16, State 2, Procedure sp_refreshsqlmodule_internal, Line 75
Operand type clash: datetime is incompatible with ntext
Msg 206, Level 16, State 2, Procedure sp_refreshsqlmodule_internal, Line 75
Operand type clash: bit is incompatible with ntext
Msg 206, Level 16, State 2, Procedure sp_refreshsqlmodule_internal, Line 75
Operand type clash: int is incompatible with ntext
Msg 206, Level 16, State 2, Procedure sp_refreshsqlmodule_internal, Line 75
Operand type clash: int is incompatible with ntext

Could there be a different way of refreshing the views?

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 5/9/2013 10:15:52 PM
   
RE:Error updating - Failed to create new object of class 'CMS.Document': String was not recognized as a valid DateTime.
Hello,

What is the current version of Kentico you are using and also, what is the version of the SQL server? The "sp_refreshsqlmodule_internal" is a system stored procedure, so it is very strange that it is returning an error.

Best regards,
Juraj Ondrus

User avatar
Member
Member
Raymond A - 5/10/2013 6:36:14 AM
   
RE:Error updating - Failed to create new object of class 'CMS.Document': String was not recognized as a valid DateTime.
Hi ,

Filip helped me go through by refreshing the views from the CMS Site Manager. Apparently the error was caused by a custom view that was Schema Bound.

By removing the biding it all went well.

Thanks