Try our conversational search powered by Generative AI!
AI OnAI Off
May 13, 2019
Mar 02, 2020
CMS Core
Closed, Fixed and tested
The log for creating a block property in PropertyDataFactory is not formatted correctly, it is not using _log.WarnFormat or creating the log message using string.format. The log message should use the ‘blockTypeReference.ModelTypeString’ so that the log message contains the type which failed to load.
Code here:
private PropertyData CreateBlockProperty(BlockTypeReference blockTypeReference) { Type type2; if (!string.IsNullOrEmpty(blockTypeReference.ModelTypeString)) { Type type = TypeResolver.GetType(blockTypeReference.ModelTypeString, throwOnError: false); if (type == null) { if (_log.IsWarnEnabled) { _log.Warn("Could not load type '{0}', hence creating untyped property PropertyBlock<BlockData> instead"); } type = typeof(BlockData); } if (!typeof(BlockData).IsAssignableFrom(type)) { throw new TypeMismatchException(string.Format(CultureInfo.InvariantCulture, "The block type {0} does not inherit from the required class {1}", type.FullName, typeof(BlockData).FullName)); } type2 = typeof(PropertyBlock<>).MakeGenericType(type); } else { type2 = typeof(PropertyBlock<BlockData>); } return CreateInstance(type2); }