Diagnosing Glass Mapper issues in Sitecore

  • Introduction

    Glass Mapper is a third-party module that is widely used by Sitecore partners in their solutions. Sitecore and Glass Mapper have not been tested together, so we cannot guarantee the stability of such a configuration.

    This article provides some examples of issues which might occur during such integration, and some diagnostics steps you can take in order to clarify if an issue is related to Glass Mapper.

  • Potential issues and diagnostics

    High CPU usage or site slowness

    Glass Mapper functionality uses fast queries (called from the SelectItems(string query) method) in some of its methods (for example, MapToProperty()) in order to read items from the database. These type of queries may cause slowness.

    Diagnostics: Try to disable the Glass.Mapper.SC.SitecoreService.CreateType(Item, Boolean, Boolean) and MapToProperty() calls and re-check the CPU utilization and response times.

    Solution: Refactor Glass Mapper code and use the search functionality instead of fast queries. Contact Glass Mapper support for further assistance.

    High memory utilization

    Diagnostics: Comment out the usage of the Glass.Mapper.Pipelines.ObjectConstruction.Tasks.CreateInterface.InterfacePropertyInterceptor.LoadAllValues() method in custom code or Glass Mapper sources used in a Sitecore-based project. Observe the memory usage levels and see if the issue persists.

    Solution: Contact Glass Mapper support.

    Text or links are wrongly encoded on your page

    Diagnostics: Replace Glass Mapper helpers with default Sitecore ones (for example, @Html().Sitecore().Field(…)), and see if the issue persists.

    Solution: Ensure that you use the latest Glass Mapper version, use the default helpers, or contact Glass Mapper support.

    Rendering problems in Experience Editor or front-end site on pages with Glass Mapper helpers

    Diagnostics: Replace Glass Mapper helpers with default Sitecore ones (for example, @Html().Sitecore().Field(…)), and see if the issue persists.

    Solution: Ensure that you use the latest Glass Mapper version, use the default helpers, or contact Glass Mapper support.

  • General Recommendations and useful links

Applies to:

CMS 6+

September 21, 2017
September 21, 2017

Keywords: 

  • MVC