Try our conversational search powered by Generative AI!

PropertyFor renders type string instead of HTML

Vote:
 

Just updated from CMS 12.2.1 to 12.3.0. Now all calls to Html.DisplayFor and Html.PropertyFor renders the string "EPiServer.Web.Mvc.Html.Internal.DeferredHtmlContent" instead of the expected HTML.

What is this (no documentation about such change)? And what needs to be changed for this to render HTML again?

#271136
Feb 04, 2022 7:05
Vote:
 

I've just done a test myself upgrading a very basic site for myself and it's working fine for me. 

An XhtmlString on the StartPage using @Html.PropertyFor is rednering the content out

#271140
Feb 04, 2022 10:15
Vote:
 

Same results as Scott, after updating the package versions in Foundation to 12.3.0 -- rendering okay for me.

#271145
Feb 04, 2022 15:48
Vote:
 

It seems like some content area rendering customizations broke with this minor update.

I guess that with 12.3.0, content area rendering implements IHtmlContent with DeferredHtmlContent (which does not return HTML when calling ToString) instead of HtmlString.

#271146
Feb 04, 2022 16:01
Vote:
 

Hi there! For performance improvements the internal implementation of PropertyFor was changed in the 12.3 release to not return IHtmlContent based on HtmlString which changed the behaviour of ToString().  We will release an update for this in 12.4 which will revert ToString() back to it's original behaviour. In the meantime a work around is to instead call IHtmlContent.WriteTo() with a StringWriter which will give you the html string in 12.3.

#271353
Feb 08, 2022 10:48
* 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.