Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up Roslyn Public API Analyzer #449

Merged
merged 4 commits into from
May 10, 2024

Conversation

adamreeve
Copy link
Contributor

Set up the Roslyn Public API analyzer which should detect changes that break the API or ABI.

We need per-target public API files due to having some methods that use the Half, DateOnly and TimeOnly types that are only available for targets >= net6.

I've had to disable some warnings about overloaded methods that have optional arguments. We can't change those now that they've been shipped.

Any local changes can be automatically added to the unshipped API txt file with:

dotnet restore
dotnet format analyzers --diagnostics=RS0016 --no-restore

(Others might not need the separate restore and --no-restore argument but I had to do it that way to work around a bug)

Then when we make a release we should manually move anything in the unshipped files over to the shipped files.

There are more details in https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md

Copy link
Contributor

@marcin-krystianc marcin-krystianc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I naively thought that we could avoid the burden of tools like this and, with enough care during manual reviews, prevent the API/ABI from being broken. However, as we've recently seen, this is not the case. Having automation to help maintain API/ABI stability is essential.

Well done 🏆

@adamreeve adamreeve merged commit 7d3e423 into G-Research:master May 10, 2024
33 checks passed
@adamreeve adamreeve deleted the api_analyzer branch May 10, 2024 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants