Display Options are not sorted in the order they were added

Found in

EPiServer.CMS.Core 9.9.1

Fixed in

EPiServer.CMS.Core 10.3.1

Created

Dec 06, 2016

Updated

Mar 31, 2017

Area

CMS Core

State

Closed, Fixed and tested


Description

  1. Create an initialization module (or change DisplayRegistryInitialization in Alloy templates)
  2. Add code like this:

        public void Initialize(InitializationEngine context)
        {
            var options = ServiceLocator.Current.GetInstance<DisplayOptions>();
 
            options.Add("full", "100%", "block-100", "", "epi-icon__layout--full");
            options.Add("threequarter", "75%", "block-75", "", "epi-icon__layout--three-quarter");
            options.Add("twothird", "66%", "block-66", "", "epi-icon__layout--two-thirds");
            options.Add("half", "50%", "block-50", "", "epi-icon__layout--half");
            options.Add("onethird", "33%", "block-33", "", "epi-icon__layout--one-third");
            options.Add("onequarter", "25%", "block-25", "", "epi-icon__layout--one-quarter");
 
            AreaRegistration.RegisterAllAreas();
        }

Expected: A display option list in the UI with the options in the order they were added.

100%
75%
66%
50%
33%
25%

Actual:

75%
25%
66%
100%
50%
33%