dotnet / dotnet/sdk

GenAPI: consider a namespace-based heuristic for including internal compiler attributes

Open
#54,527 0 comments 0 reactions 0 assignees View on GitHub
Area-GenAPI untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

Follow-up to the revival of #38232 (PR reviving the `--include-api-file` / `IncludeApiFiles` mechanism and the curated `s_compilerAttributes` default list).

Today GenAPI emits a hardcoded, curated set of internal compiler attributes (e.g. `IsExternalInit`, `RequiredMemberAttribute`, the nullable analysis attributes) when they are defined in an assembly, so that the generated reference source keeps working with the same language features. See `s_compilerAttributes` in `src/Compatibility/GenAPI/Microsoft.DotNet.GenAPI/GenAPIApp.cs`.

A curated list is inherently incomplete and must be manually maintained as the BCL/compiler add new out-of-band attributes. In the original PR discussion (#38232), @333fred proposed a more general namespace-based heuristic (e.g. automatically include internal types under `System.Runtime.CompilerServices` / `System.Diagnostics.CodeAnalysis` that the compiler recognizes) instead of an explicit list.

This issue tracks designing and implementing that more general approach so the curated list can eventually be removed or reduced.

cc @ViktorHofer

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.