Skip to content

Adopt Microsoft.CodeAnalysis.PublicApiAnalyzers to track the public API surface #340

Description

@thomhurst

Problem

The library's public surface has drifted without oversight — incidental members shipped (wrapper-struct equality operators, Deconstruct), and behavioural contracts (input enumerated once vs lazily) changed without any tripwire. PR #332 removes surface as part of v4; nothing prevents the next accidental addition or removal.

Proposal

Add Microsoft.CodeAnalysis.PublicApiAnalyzers to the library project:

  • PublicAPI.Shipped.txt seeded from the v4 surface at release.
  • PublicAPI.Unshipped.txt for in-flight changes.
  • CI fails on undeclared surface changes; reviewing a PR that touches the API becomes a one-file diff.

Acceptance criteria

  • Analyzer active on all TFMs, zero diagnostics at baseline.
  • CONTRIBUTING note: how to update the txt files when intentionally changing the API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions