Try our conversational search powered by Generative AI!

CMS UI page editing validation starts failing unexpectedly

Vote:
 

Hi

Validation of pages in UI will sometimes start failing, not matter which , usually after some uptime. Commonly detected when modifiing settings on the pages we use for global settings.

Sometimes it goes away when restarting the webbserver instance, sometimes not.

The script gets a 500 error.

This is what happens in the log:

2024-03-01 10:11:05.2502|ERROR|Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware|An unhandled exception has occurred while executing the request.|System.ArgumentNullException: Value cannot be null. (Parameter 'value')
   at System.ComponentModel.DataAnnotations.ValidationContext.set_DisplayName(String value)
   at EPiServer.Validation.DataAnnotationsValidator`1.ValidateInstance(Object instance, List`1 validationResult, ValidationContext validationContext)
   at EPiServer.Validation.DataAnnotationsValidator`1.ValidateInstance(Object instance, List`1 validationResult, ValidationContext validationContext)
   at EPiServer.Validation.DataAnnotationsValidator`1.Validate(T instance) 

........

Cannot replicate the issue in development, so it's a pain trying the find the real cause.
It looks like Episerver suddenly looses its ability to get the displayname from properties.

None of the properties on eg the settings page have any name specified, could it be a localization issue?

#318323
Edited, Mar 01, 2024 9:58
Vote:
 

Finding this following the source:

EPiServer.Validation.DataAnnotationsValidator<T>:

  protected virtual string GetDisplayName(PropertyDescriptor propertyDescriptor, object instance)
  {
    string resourceKey = propertyDescriptor.Attributes.OfType<DisplayAttribute>().FirstOrDefault()?.Name ?? propertyDescriptor.DisplayName;
    return _localizationService.GetString(resourceKey, _localizationService.FallbackBehavior | FallbackBehaviors.Echo);
  }

Is this what is returning null?

#318324
Mar 01, 2024 10:38
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.