I've been getting a string to date conversion error randomly on some tasks, most recently on trying to empty my trash.
I understand what the error is, but have NO idea where to begin to look to fix it. Has anyone encountered something similar?
Error/Stack Trace:
Received an error from the server
An error occured
Value "Monday, January 27, 2015" of type "System.String" could not be converted to type "System.DateTime" which is expected by property type "date".
Exception Details
System.InvalidOperationException: Value "Monday, January 27, 2015" of type "System.String" could not be converted to type "System.DateTime" which is expected by property type "date".
Stacktrace
at Umbraco.Core.Models.Property.ThrowTypeException(Object value, Type expected, String alias)
at Umbraco.Core.Models.Property.setValue(Object value)
at Umbraco.Core.Persistence.Factories.PropertyFactory.BuildEntity(PropertyDataDto[] dtos)
at Umbraco.Core.Persistence.Repositories.VersionableRepositoryBase2.GetPropertyCollection(Sql docSql, IEnumerable1 documentDefs)
at Umbraco.Core.Persistence.Repositories.ContentRepository.ProcessQuery(Sql sql)
at Umbraco.Core.Persistence.Repositories.ContentRepository.PerformGetByQuery(IQuery1 query)
at Umbraco.Core.Persistence.Repositories.RepositoryBase2.GetByQuery(IQuery1 query)
at Umbraco.Core.Persistence.Repositories.RecycleBinRepository2.GetEntitiesInRecycleBin()
at Umbraco.Core.Services.ContentService.EmptyRecycleBin()
at Umbraco.Web.Editors.ContentController.EmptyRecycleBin()
at lambdamethod(Closure , Object , Object[] )
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>cDisplayClass10.9(Object instance, Object[] methodParameters)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ApiControllerActionInvoker.
String to date conversion error.
Hello:
I've been getting a string to date conversion error randomly on some tasks, most recently on trying to empty my trash.
I understand what the error is, but have NO idea where to begin to look to fix it. Has anyone encountered something similar?
Error/Stack Trace:
Received an error from the server
An error occured Value "Monday, January 27, 2015" of type "System.String" could not be converted to type "System.DateTime" which is expected by property type "date". Exception Details System.InvalidOperationException: Value "Monday, January 27, 2015" of type "System.String" could not be converted to type "System.DateTime" which is expected by property type "date". Stacktrace at Umbraco.Core.Models.Property.ThrowTypeException(Object value, Type expected, String alias) at Umbraco.Core.Models.Property.setValue(Object value) at Umbraco.Core.Persistence.Factories.PropertyFactory.BuildEntity(PropertyDataDto[] dtos) at Umbraco.Core.Persistence.Repositories.VersionableRepositoryBase
2.GetPropertyCollection(Sql docSql, IEnumerable
1 documentDefs) at Umbraco.Core.Persistence.Repositories.ContentRepository.ProcessQuery(Sql sql) at Umbraco.Core.Persistence.Repositories.ContentRepository.PerformGetByQuery(IQuery1 query) at Umbraco.Core.Persistence.Repositories.RepositoryBase
2.GetByQuery(IQuery1 query) at Umbraco.Core.Persistence.Repositories.RecycleBinRepository
2.GetEntitiesInRecycleBin() at Umbraco.Core.Services.ContentService.EmptyRecycleBin() at Umbraco.Web.Editors.ContentController.EmptyRecycleBin() at lambdamethod(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>cDisplayClass10.9(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ApiControllerActionInvoker.Hi Ian
Can you show the code that causes the issue? It's easy to fix this transformation but we have to see the code first :)
Alex
Hi Alex,
Thanks for the reply.
I get the error when I try to empty my recycle bin or when I try to load my website for only the first time after a "rebuild".
It's not specifically throwing the error on a certain code block. That's why I don't know how to start looking for the error.
is working on a reply...