"Illegal recursion detected" error when loading SXA website on a mobile device

  • SXA website pages might fail to load with a high CPU usage and an unhandled exception if the page is requested with a mobile device or in the mobile mode of a desktop browser. The root cause of the issue is an infinite recursion on page load when using a component variant field for a mobile device. The following message can be found in the log:

    Exception: System.InvalidOperationException
    Message: Illegal recursion detected: GetModel
    Source: Sitecore.Mvc
    at Sitecore.Mvc.Common.RecursionPreventer..ctor(String title, Flag flag)
    at Sitecore.Mvc.Presentation.Rendering.GetModel()
    at Sitecore.Mvc.Presentation.Rendering.get_Model()
    at Sitecore.XA.Foundation.Mvc.Wrappers.Rendering.get_Item()
    ...
    

Applies to:

SXA 1.6 Initial Release - 1.8 Update-1

SXA 1.9 Initial Release

February 27, 2020
February 27, 2020

Reference number:

315324

Keywords: 

  • SXA