PropertyLinkCollection loses all links if RemapPermanentLinkReferences is called

Found in

EPiServer.CMS.Core 9.12.0

Fixed in

EPiServer.CMS.Core 10.0.1


Aug 17, 2016


Nov 08, 2016


CMS Core


Closed, Fixed and tested


The PropertyLinkCollection inherits from PropertyXhtmlString but doesn't populate the XhtmlString value if the value is set to a LinkCollection.

This has a few side effects, primarily that all links are removed if RemapPermanentLinkReferences is called.

Example unit test from PropertyLinkCollectionTest.cs.

public void RemapPermanentLinkReferences_WhenLinksAreSet_ShouldRemapLinks()
    var originalGuid = Guid.NewGuid();
    var remappedGuid = Guid.NewGuid();
    var property = new PropertyLinkCollection();
    property.Links = new LinkItemCollection { new LinkItem { Href = PermanentLinkUtility.GetPermanentLinkVirtualPath(originalGuid, ".txt"), UrlResolver = UrlResolver() } };
    var map = new Dictionary<Guid, Guid> { { originalGuid, remappedGuid } };
    var expected = PermanentLinkUtility.GetPermanentLinkVirtualPath(remappedGuid, ".txt");
    Assert.Equal(expected, property.Links[1].Href);

Breaking Changes

  • PropertyLinkCollection no longer inherits PropertyXhtmlString. It is now a direct base class to PropertyLongString, which means that properties and methods inherited from PropertyXhtmlString are no longer available.