1

We recently upgraded from Sitecore 8.2.0 to Sitecore 9.2.0. Along with other packages, we also upgraded to the latest compatible version of Glass Mapper 5 for Sitecore 9.2.0.

We use Simple Injector for DI and the following were added to ensure that Glass Mapper dependencies load fine:

  container.Register<ISitecoreService>(() => new SitecoreService(Sitecore.Context.Database));
  container.Register<IGlassHtml>(() => new GlassHtml(container.GetInstance<ISitecoreService>()));
  container.Register<IRequestContext>(() => new Glass.Mapper.Sc.Web.RequestContext(container.GetInstance<ISitecoreService>()));
  container.Register<IMvcContext>(() => new MvcContext(container.GetInstance<ISitecoreService>(), container.GetInstance<IGlassHtml>()));

The issue we now face is that we are using a model for our layout item. The model implements IRenderingModel. When the page loads, the Model is empty. The initialize method that model defines is never executed.

Additionally, even the placeholders on the page fail to render as we get the following warning in the log for all the palceholders:

WARN The "random" placeholder was not rendered in the "XXX" item ({XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}) rendering context. Possible causes: 1) Rendering markup was taken from HTML cache, thus no rendering process took place, and diagnostic message can be safely ignored; 2) Rendering markup was not rendered due to no parent placeholder was found - item rendering settings should be checked; You can control the presence of these messages via 'Rendering.TraceUnusedRenderings' Sitecore Configuration setting.

We have verified that the renderings are published and the sequence in which they need to be present for the placeholders to be valid exists.

There are other MVC models created for renderings and they seem to have the initialize method invoked for them. If we explicitly call the initialize method from the layout for the model, all works fine.

Need help to figure out what is preventing the pages from loading properly.

2
  • what was the fix in your case? Commented Apr 1, 2020 at 14:35
  • We ended up invoking the model's initialize method explicitly. I also raised an issue in GIT with the GlassMapper team and they seem to be working on it currently. Commented Apr 7, 2020 at 18:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.