FragmentFactory.Accessor serialization issue

Vote:
 

Anyone looked into errors like this one and know something?

Serialization and deserialization of 'EPiServer.ServiceLocation.ServiceAccessor`1[[EPiServer.Core.Internal.ContentFragmentFactory,
EPiServer, Version=12.20.3.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7]]' instances is not supported.
The unsupported member type is located on type 'EPiServer.ServiceLocation.ServiceAccessor`1[EPiServer.Core.Internal.ContentFragmentFactory]'.
Path: $.SomeContentArea.FragmentFactory.Accessor.
<--- Serialization and deserialization of 'EPiServer.ServiceLocation.ServiceAccessor`1[[EPiServer.Core.Internal.ContentFragmentFactory,
EPiServer, Version=12.20.3.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7]]' instances is not supported.
#318849
Mar 12, 2024 13:22
Vote:
 

After spending more time in Application Insights I found that for us, this only occurred on POST requests (and also a few HEAD requests were sent and triggered it too) and when a controller was missing those attributes.

Not sure on the exact point that triggered the error but it was somewhere later in the middleware processing when MVC hadn't picked up up the route+HTTP-method combo.

Something similar to this will roll out... Can't reproduce locally with this change.

Would like to have global fix that also sends content-length header but haven't solved that yet.

[HttpGet]
[HttpHead] // <= added
[HttpPost] // <= added
public Microsoft.AspNetCore.Mvc.ActionResult Index(StartPageType currentPage)
{
    if (string.Equals(this.HttpContext.Request.Method, "HEAD", StringComparison.OrdinalIgnoreCase))  // <= added
    {
        return new StatusCodeResult(200);
    }

    var model = CreateModel(currentPage);
    return View(model);
}
#330492
Edited, Sep 25, 2024 9:03
* 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.