dotnet / dotnet/docfx

[Bug] Attribute is not included as metadata if attribute has no constructor

Open
#9,688 0 comments 0 reactions 0 assignees View on GitHub
dotnet
Dominant language
C#
Stars
4.4k
Forks
890
Avg merge
2h 9m
Merged PRs (30d)
11

Description

**Describe the bug**
Class/Property/Field attribute is not included if attribute has no constructor.

**To Reproduce**
Execute `docfx metadata` command to following source.

```
using System;

namespace Sample
{
public class Test1Attribute : Attribute
{
}

public class Test2Attribute : Attribute
{
public Test2Attribute() { }
}

[Test1]
[Test2]
public class Class1
{
}
}
```

**Generated API metadata for `Test1.Class1.yml` **
```
- uid: Sample.Class1
attributes:
- type: Sample.Test2Attribute
ctor: Sample.Test2Attribute.#ctor
```

**Expected behavior**
`TestAttribute1` should be contained as class attributes.

**Context (please complete the following information):**
- OS: Windows
- Docfx version: 2.75.2

**Additional context**

It seems to be excluded by `symbol.IsImplicitlyDeclared` checks at following code.
https://github.com/dotnet/docfx/blob/29283618e0020cb89dba310e7074c1b0ffc30f81/src/Docfx.Dotnet/SymbolFilter.cs#L95-L99

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.