3

We have recently migrated from Sitecore 8.2 to 9. It seems that Sitecore 9 is doing link validation in a different way than previous versions. It seems that in our system in 8.2 there have been saved lots of broken links. The raw value of these links is of the form:

<link linktype="internal" />

A valid link Raw Value is of the form:

<link linktype="internal" id="{FAE49592-9B39-407E-A996-2121FF88447D}" />

So the id is missing in the broken links and this causes lots of problems now. First, we get an error System.FormatException: Unrecognized Guid format when we try to save items containing a broken link. Second, errors are thrown during publish and the publish process is stopped in it's tracks. The error thrown is like:

    Job started: Publish to 'web'|#Exception: System.Reflection.TargetInvocationException: 
Exception has been thrown by the target of an invocation. ---> 
System.FormatException: Unrecognized Guid format. Actual value:  ---> System.FormatException: Unrecognized Guid format.
   at System.Guid.GuidResult.SetFailure(ParseFailureKind failure, String failureMessageID, Object failureMessageFormatArgument, String failureArgumentName, Exception innerException)
   at System.Guid.TryParseGuid(String g, GuidStyles flags, GuidResult& result)
   at System.Guid..ctor(String g)
   at Sitecore.Data.ID..ctor(String id)
   --- End of inner exception stack trace ---
   at Sitecore.Data.ID..ctor(String id)
   at Sitecore.Xml.Xsl.LinkUrl.GetInternalUrl(Database database, String url, String itemID, String anchor, String queryString)
   at Sitecore.Xml.Xsl.LinkUrl.GetUrl(XmlField field, Database database)
   at Sitecore.Data.Fields.LinkField.get_InternalPath()
   at Sitecore.Data.Fields.LinkField.ValidateLinks(LinksValidationResult result)
   at Sitecore.Links.ItemLinks.AddLinks(Field field, List`1 links, ItemLinkState linkState)
   at Sitecore.Links.ItemLinks.GetLinks(ItemLinkState linkState, Boolean allVersions, Boolean includeStandardValuesLinks)
   at Sitecore.Links.ItemLinks.GetValidLinks(Boolean allVersions)
   at Sitecore.Publishing.Pipelines.GetItemReferences.AddItemLinkReferences.GetReferences(Item item, Boolean sharedOnly, HashSet`1 processedItems)
   at Sitecore.Publishing.Pipelines.GetItemReferences.AddItemLinkReferences.GetItemReferences(PublishItemContext context)
   at Sitecore.Publishing.Pipelines.GetItemReferences.GetItemReferencesProcessor.Process

So the error occurs in the ValidateLinks function.

I wonder why these errors did not occur in Sitecore 8 and they are now in Sitecore 9. And what would be the best way to solve these problems? We can't find a configuration option to not validate links during publish.

We could write a script to cleanup the broken links. We could hook into the publishing pipeline to do some cleaning before the "GetItemRefrences" processor is executed. But it seems that we should be able to solve this with some config option.

0

Yes this is a known issue with Sitecore 9 publishing engine. We also encountered same issue and wrote a powershell script to clean up the invalid links traversing through the entire Sitecore tree...

Hope this helps!

  • 1
    It might help if you shared some of your solution (script)... – Gatogordo Sep 12 '18 at 9:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.