SaaS CMS has officially launched! Learn more now.

Cannot create a new block from Content area's "Create a new block" option.


We upgraded our CMS version from 12.22.2 to 12.22.3 yesterday since we wanted to roll back to the old way of creating blocks to the Content area's "Create a new block" option from Inline blocks. Unfortunately, it seems that there might be a bug in the newest version.

Steps to reproduce:

1. Upgrade to Episerver.CMS 12.22.3.
2. Find a page type with Content Area.
3. Click "Create a new block".
4. Fill in the required data and try to publish.

I've tried on some different types of pages with content area property as well as with different block types, but none of them works.
The error:

There is no error on Episerver's UI basically nothing happens.
The error that I get in the Console.

fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
      An unhandled exception has occurred while executing the request.
      System.ArgumentNullException: Value cannot be null. (Parameter 'content')
         at EPiServer.Framework.Validator.ThrowIfNull(String name, Object value)
         at EPiServer.Cms.Shell.UI.Rest.Internal.ContentDataStore.Post(PostContentModel entity)
         at lambda_method3551(Closure, Object, Object[])
         at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
      --- End of stack trace from previous location ---
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
      --- End of stack trace from previous location ---

Edited, Aug 09, 2023 12:45

I will forward this question to our CMS UI team. Thanks for bringing this to our attention and apologies for any inconvenience it might have caused.

Aug 09, 2023 15:42
Quan Mai - Aug 09, 2023 15:43
created bug CMS-29338

Adrian, what do you mean by `Fill in the required data and try to publish.`?

After upgrading to 12.22.3 `Create a new block` works as before. You should see the old UI like this:

When does the exception happen? After you click on `Create`? Or when you try to publish the parent page? Or another time?

Aug 09, 2023 16:55

Hello Bartosz.

I meant "Any properties that are required" so for example it might be a title with the attribute "[Required]" but, it is not relevant when all properties are optional.

I can see the old UI when creating blocks (so 2 options in the content area, 1st "Create a new block" and "Select Content") that's expected. The error appears when I click the "Create" button (this blue one from your screenshot).

Sorry, I can't upload images :) 

Aug 09, 2023 18:21
Quan Mai - Aug 10, 2023 6:27
if you have trouble uploading here, you can upload to imgur for example then post the link here

Images and some code would be highly appreciated. We were not able to reproduce the issue on our test environments.

Are you able to reproduce the issue in Alloy?

Aug 09, 2023 19:44

Hello Bartosz,

I've noticed the same behavior (but I'm not sure which version introduced this issue due to the fact that we upgraded packages from version 12.14.0 straight to the newest 12.22.3).
A quick debugging session led me to the conclusion that the model is correctly sent in the request's body but is not bound to the `PostContentModel` parameter inside the `ContentDataStore` Post endpoint.

I suspect that the issue might be connected with the `NewtonsoftJsonInputFormatter` as at some point while parsing the body it throws an exception thus `PostContentModel` has a default, null value.

Could you please enable this formatter in your test environment and check if you are able to reproduce the issue?

Aug 10, 2023 9:26

Piotr, would it be possible for you to check if the same issue with serialization happens in CMS 12.20.0?

Aug 11, 2023 6:31

We found out the issue. It's been introduced in CMS 12.19.0, it is unrelated to inline blocks however we are going to fix it asap.

A new version 12.22.4 will be out soon.

As Adrian, pointed out, it seems to only affect customers who have custom newtonsoft converters (probably from some customer properties) which causes ContentDataStore to fallback to newtonsoft serializer.

The issue does not happen on our default System.Text.Json

Aug 11, 2023 13:27
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.