Static constructor in SiteDefinition should not access IOC container

Found in

EPiServer.CMS.Core 11.1.0

Fixed in

EPiServer.CMS.Core 11.2.1

Created

Nov 27, 2017

Updated

Dec 01, 2017

Area

CMS Core

State

Closed, Fixed and tested


Description

Currently, the static constructor in SiteDefintion accesses the IOC container through usage of MakeReadOnly of SiteDefintion.Empty.
This can cause a problem under certain circumstances. For example, the first access to the type (which causes the static constructor) is done in a stack frame that is already dependent on SiteDefintion.Current (directly or indirectly). This is a problem because a circular dependency exception may result.