-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Microsoft.CodeAnalysis.PublicAnalyzers is a Roslyn analyzer that tracks public API changes, helping to preventing unwanted ones and driving API review processes. It is used by ASP.NET and many other internal and external projects.
In a nutshell, your project has PublicAPI.Shipped.txt and PublicAPI.Unshipped.txt; the former contains a snapshot of the public API surface in the latest shipped version, and the latter contains changes from that to vNext. Any change in the public surface requires the Unshipped file to be updated, otherwise the build is failed (the analyzer has a code fix for doing this automatically from the IDE). Upon release, the Unshipped changes are merged into the Shipped snapshot.
- Automation can tag PRs that touch the Unshipped file with a label, and the team can then go over these in API review (this is roughly the ASP.NET process).
- Having full git history for the public surface is useful - it becomes very easy to track exactly which changes were made when (e.g. git log on the Unshipped file).
- Microsoft.CodeAnalysis.PublicAnalyzers is actively maintained and supports new language constructs such as nullable reference types.
EF Core specifically makes extensive use of pubternal, which needs to be exempted from tracking. This is tracked by dotnet/roslyn-analyzers#4736, I'm working on contributing this.