Skip to content

Cannot assign value "<date>" of type "System.String" to property "" expecting type "System.DateTime". #272

@Matthew-Wise

Description

@Matthew-Wise

Running on all latest versions of Deploy (16.0.0) (with Contrib and Forms) and Umbraco (16.0.0) I pushed a single page to the developement environment, which was successful however on viewing the page I get the following

Image
{
    "type": "Error",
    "title": "Cannot assign value \"18/04/2025 00:00:00 +01:00\" of type \"System.String\" to property \"dateStamp\" expecting type \"System.DateTime\".",
    "status": 500,
    "detail": "   at Umbraco.Cms.Core.Models.Property.ThrowTypeException(Object value, Type expected, String alias)\r\n   at Umbraco.Cms.Core.Models.Property.TryConvertAssignedValue(Object value, Boolean throwOnError, Object& converted)\r\n   at Umbraco.Cms.Core.Models.Property.SetValue(Object value, String culture, String segment)\r\n   at Umbraco.Cms.Core.PropertyEditors.BlockValuePropertyValueEditorBase`2.MapBlockItemDataToEditor(IProperty property, List`1 items, String culture, String segment)\r\n   at Umbraco.Cms.Core.PropertyEditors.BlockValuePropertyValueEditorBase`2.MapBlockValueToEditor(IProperty property, TValue blockValue, String culture, String segment)\r\n   at Umbraco.Cms.Core.PropertyEditors.BlockEditorPropertyValueEditor`2.ToEditor(IProperty property, String culture, String segment)\r\n   at Umbraco.Cms.Core.PropertyEditors.BlockValuePropertyValueEditorBase`2.MapBlockItemDataToEditor(IProperty property, List`1 items, String culture, String segment)\r\n   at Umbraco.Cms.Core.PropertyEditors.BlockValuePropertyValueEditorBase`2.MapBlockValueToEditor(IProperty property, TValue blockValue, String culture, String segment)\r\n   at Umbraco.Cms.Core.PropertyEditors.BlockEditorPropertyValueEditor`2.ToEditor(IProperty property, String culture, String segment)\r\n   at Umbraco.Cms.Api.Management.Mapping.Content.ContentMapDefinition`3.<>c__DisplayClass4_1.<MapValueViewModels>b__1(IPropertyValue propertyValue)\r\n   at System.Linq.Enumerable.ListSelectIterator`2.MoveNext()\r\n   at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()\r\n   at System.Linq.Enumerable.IEnumerableWhereIterator`1.ToArray()\r\n   at Umbraco.Cms.Api.Management.Mapping.Content.ContentMapDefinition`3.MapValueViewModels(IEnumerable`1 properties, ValueViewModelMapping additionalPropertyMapping, Boolean published)\r\n   at Umbraco.Cms.Api.Management.Mapping.Document.DocumentMapDefinition.Map(IContent source, DocumentResponseModel target, MapperContext context)\r\n   at Umbraco.Cms.Core.Mapping.UmbracoMapper.Map[TTarget](Object source, Type sourceType, MapperContext context)\r\n   at Umbraco.Cms.Core.Mapping.UmbracoMapper.Map[TTarget](Object source)\r\n   at Umbraco.Cms.Api.Management.Factories.DocumentPresentationFactory.CreateResponseModelAsync(IContent content, ContentScheduleCollection schedule)\r\n   at Umbraco.Cms.Api.Management.Controllers.Document.ByKeyDocumentController.ByKey(CancellationToken cancellationToken, Guid id)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)\r\n   at Umbraco.Cms.Web.Common.Middleware.BasicAuthenticationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n   at Umbraco.Cms.Api.Management.Middleware.BackOfficeExternalLoginProviderErrorMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)\r\n   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)\r\n   at Umbraco.Cloud.Cms.PublicAccess.Middleware.CloudPublicAccessMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n   at Umbraco.Deploy.Infrastructure.Middleware.BearerTokenAuthenticationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)\r\n   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)\r\n   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)\r\n   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)\r\n   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)\r\n   at StackExchange.Profiling.MiniProfilerMiddleware.Invoke(HttpContext context) in C:\\projects\\dotnet\\src\\MiniProfiler.AspNetCore\\MiniProfilerMiddleware.cs:line 112\r\n   at Umbraco.Cms.Web.Common.Middleware.UmbracoRequestMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Umbraco.Cms.Web.Common.Middleware.UmbracoRequestMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n   at Umbraco.Cms.Web.Common.Middleware.PreviewAuthenticationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n   at Umbraco.Cms.Web.Common.Middleware.UmbracoRequestLoggingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)",
    "instance": "InvalidOperationException"
}

Bug summary

This Date Picker is on a block list item that is on a block within another block list. (main list -> child list -> date picker)

The date picker is configured as below and is not mandatory

Image

Workaround Attempts

Tried both methods here without success - #209

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions