Images validators may cause exceptions in logs


Description

Sitecore may log the following errors to log files when performing various operations with Image fields – such as setting images, editing image properties, etc.

These errors appear during the validation of Image fields using built-in validators and they do not affect the functionality of a website.
ERROR Attempted to load invalid xml. 
Exception: System.Xml.XmlException
Message: Data at the root level is invalid. Line 1, position 1.
. . . ERROR First 200 characters: /Images/SampleImage ERROR Call stack:    at Sitecore.MainUtil.GetCallStack()    at Sitecore.Xml.XmlUtil.LoadXml(String xml)    at Sitecore.Shell.Applications.ContentEditor.XmlValue.GetAttribute(String name)    at Sitecore.Data.Validators.FieldValidators.ImageSizeValidator.Evaluate() . . .

Solution

  1. Copy the Sitecore.Support.368362.dll assembly to the /bin folder of your web site.
  2. Open the following item:
    /sitecore/system/Settings/Validation Rules/Field Rules/System/Image Has Alt Text
  3. Replace the default value in its Type field with the following one:
    Sitecore.Support.Data.Validators.FieldValidators.ImageAltFieldValidator,Sitecore.Support.368362
  4. Open the following item:
    /sitecore/system/Settings/Validation Rules/Field Rules/System/Image Size
  5. Replace the default value in its Type field with the following one:
    Sitecore.Support.Data.Validators.FieldValidators.ImageSizeValidator,Sitecore.Support.368362