private void CacheProperties()

in src/log4net/Core/LoggingEvent.cs [1184:1217]


  private void CacheProperties()
  {
    if (_data.Properties is null && _cacheUpdatable)
    {
      if (_compositeProperties is null)
      {
        CreateCompositeProperties();
      }

      var flattenedProperties = _compositeProperties!.Flatten();

      var fixedProperties = new PropertiesDictionary();

      // Validate properties
      foreach (KeyValuePair<string, object?> entry in flattenedProperties)
      {
        object? val = entry.Value;

        // Fix any IFixingRequired objects
        if (entry.Value is IFixingRequired fixingRequired)
        {
          val = fixingRequired.GetFixedObject();
        }

        // Strip keys with null values
        if (val is not null)
        {
          fixedProperties[entry.Key] = val;
        }
      }

      _data.Properties = fixedProperties;
    }
  }