Skip to content

Commit

Permalink
fix: filter compiler generated helpers (#9489)
Browse files Browse the repository at this point in the history
  • Loading branch information
yufeih authored Nov 29, 2023
1 parent 476a2a3 commit 50b064a
Show file tree
Hide file tree
Showing 63 changed files with 6,906 additions and 3,975 deletions.
1 change: 1 addition & 0 deletions samples/seed/dotnet/assembly/BuildFromAssembly.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
Expand Down
16 changes: 16 additions & 0 deletions samples/seed/dotnet/assembly/Class1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,19 @@ public static void HelloWorld() { }
[EditorBrowsable(EditorBrowsableState.Never)]
public void HiddenAPI() { }
}

public unsafe struct Issue5432

Check warning on line 22 in samples/seed/dotnet/assembly/Class1.cs

View workflow job for this annotation

GitHub Actions / snapshot (windows-latest)

Missing XML comment for publicly visible type or member 'Issue5432'

Check warning on line 22 in samples/seed/dotnet/assembly/Class1.cs

View workflow job for this annotation

GitHub Actions / snapshot (windows-latest)

Missing XML comment for publicly visible type or member 'Issue5432'

Check warning on line 22 in samples/seed/dotnet/assembly/Class1.cs

View workflow job for this annotation

GitHub Actions / snapshot (ubuntu-latest)

Missing XML comment for publicly visible type or member 'Issue5432'

Check warning on line 22 in samples/seed/dotnet/assembly/Class1.cs

View workflow job for this annotation

GitHub Actions / snapshot (ubuntu-latest)

Missing XML comment for publicly visible type or member 'Issue5432'
{
private fixed char Name0[30];

public string Name

Check warning on line 26 in samples/seed/dotnet/assembly/Class1.cs

View workflow job for this annotation

GitHub Actions / snapshot (windows-latest)

Missing XML comment for publicly visible type or member 'Issue5432.Name'

Check warning on line 26 in samples/seed/dotnet/assembly/Class1.cs

View workflow job for this annotation

GitHub Actions / snapshot (windows-latest)

Missing XML comment for publicly visible type or member 'Issue5432.Name'

Check warning on line 26 in samples/seed/dotnet/assembly/Class1.cs

View workflow job for this annotation

GitHub Actions / snapshot (ubuntu-latest)

Missing XML comment for publicly visible type or member 'Issue5432.Name'

Check warning on line 26 in samples/seed/dotnet/assembly/Class1.cs

View workflow job for this annotation

GitHub Actions / snapshot (ubuntu-latest)

Missing XML comment for publicly visible type or member 'Issue5432.Name'
{
get
{
fixed (char* name = Name0)
{
return new string((char*)name);
}
}
}
}
7 changes: 6 additions & 1 deletion src/Docfx.Dotnet/SymbolFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public SymbolFilter(ExtractMetadataConfig config, DotnetApiOptions options)

public bool IncludeApi(ISymbol symbol)
{
return IsSymbolAccessible(symbol) && IncludeApiCore(symbol);
return !IsCompilerGeneratedDisplayClass(symbol) && IsSymbolAccessible(symbol) && IncludeApiCore(symbol);

bool IncludeApiCore(ISymbol symbol)
{
Expand All @@ -45,6 +45,11 @@ bool IncludeApiDefault(ISymbol symbol)

return symbol.ContainingSymbol is null || IncludeApiCore(symbol.ContainingSymbol);
}

static bool IsCompilerGeneratedDisplayClass(ISymbol symbol)
{
return symbol.Kind == SymbolKind.NamedType && (symbol.Name.Contains('<') || symbol.Name.Contains('>'));
}
}

public bool IncludeAttribute(ISymbol symbol)
Expand Down
Loading

0 comments on commit 50b064a

Please sign in to comment.