Metadata issue when using ApiMemberAttribute and PropertyInfo.AddAttributes

Starting in v6.4, DTO properties with an ApiMemberAttribute added at runtime via PropertyInfo.AddAttributes are not displaying the attribute’s Description property in the metadata page or code.

Using the blank .NET 6 template, adding

typeof(Hello)
  .GetProperty("Name")
  .AddAttributes(
      new ApiMemberAttribute
      {
          ParameterType = "path",
          Name = "MetaName",
          DataType = "foo",
          Description = "The name of the person to say hello to.",
          IsRequired = true,
      },
      new DataMemberAttribute());

results in the description being displayed in metadata in v6.3 and below:

However, starting with v6.4, the description is no longer displayed - although other attributes such as datatype, IsRequired, etc., as well as a dynamically added DataMemberAttributes, are.

Annotating the property itself in code still works; see HelloResponse.

Example at https://github.com/EricMunn/AddAttributesError

Thanks!

1 Like

Thanks for providing a reproduction and detailed bug report! Fix has been applied in this commit, now available on MyGet.

As always, thanks for the quick response and fix!