AI OnAI Off
I looked up how ProperyFor is used in the Alloy template project for Episerver 12 and I see that PropertyFor is used only for pages. Blocks use Html.EditAttributes helper. Why? ProperyFor doesn't work for the blocks now? It's not a part of breaking changes for 12 as far as I can see.
I tried replacing Html.EditAttributes with ProperyFor and it works fine.
I laso decompiled it and I see that in GetHtmlForDefaultMode it uses WrappedHtmlContent and doesn't use HttpContextAccessor at all. It used to be (in 12.3 at least) DeferredHtmlContent that used HttpContextAccessor. I'll try to update the veresion up to 12.6 now and see what happens...
Hello, I'm doing migration from episerver 11 to 12 and in views have this problem:
In all blocks and and in @section on @Html.PropertyFor always get this exeption:
I've debugged the decompiled code and in ContentRenderingContext HttpContextAccessor exists but the HttpContext inside it is null.
When I try to inject IHttpContextAccessor in block controller it has HttpContext null.
BUT - if i try to get it in page controller and page view (@Html.PropertyFor) it works fine a and HttpContext exists.
In Startup.cs i have it applied like this:
What is wrong? Do I have to do anything else?