-
Notifications
You must be signed in to change notification settings - Fork 732
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
Use Microsoft.CodeAnalysis.PublicApiAnalyzers to track public API surface #4165
Conversation
bc9f036
to
b9731ef
Compare
Why? We've used it and it didn't work for us. |
This is a standard way of tracking the changes to the public API surface (e.g., https://github.com/dotnet/aspnetcore, https://github.com/dotnet/winforms, https://github.com/dotnet/roslyn, etc.). |
I think experience won't be great if we use PublicApiAnalyzers with experimental flow. Those analyzers require us to add API to .txt file as we write it. Then, when API is experimental and evolves, it would mean need developer to fiddle with text files manually to make changes. IMHO not worth for RS00026 and RS00027. We can add support in API Chief for it if needed. It was deliberate choice to allow adding default params, as it does not spoil call site. The same as you can add new properties to a class, adding new default params should be harmless (or I miss something?). I am not strongly opinionated to leave APIChief, but I wouldn't mix those two - dev experience will be bad having both. |
I'm not an expert in this area, but I think there are reasons for RS00026 and RS00027 being reported.
Additive changes are generally allowed, however, some other changes may result in ABI breaking changes. |
Note that RS0026 and RS0027 are pretty opinionated rules, which are turned off in many repos. I wouldn't be too concerned if you decide to keep them disabled, it's an API design preference. |
We don't want this analyzer in this repo, we have a better solution that accounts for experimental APIs. |
@geeknoid I'd be interested in learning more about the better solution. Currently many teams are using many different solutions, with various benefits and drawbacks. It would be good to consolidate on one tool that is publicly maintained to address the needs of the ecosystem. |
I started a discussion about the support of the experimental attribute in dotnet/roslyn-analyzers#6759. |
Right now, we don't have any API tracking solution in this repository, which means we don't have any visibility of how API change from release to release. For example, we made a number of API breaking changes since Preview 6, which normally would not be allowed.
That's the price to pay for changing the public API surface. Many developers do not appreciate the risks associated with such changes. E.g., a rename of an argument may seem like a trivial thing, however, it is a binary breaking change (we've done this in |
I disagree. In this case it is limitation of the tool, that is aware only of two API stages: 'new' and 'old'. Its OK to flag all issues when you change API surface, but NOT when you are prototyping. Having tooling that reports false-positive for each code change is counter-productive. This is why we invested in API chief at first, because those analyzers were not working for us. |
@rafal-mz please allow me to reiterate the problem at hand.
We can remove PublicApiAnalyzers when we have your custom solution working here.
Since the experimental attribute is now part of the .NET platform and is supported by the compiler, the problem you're describing is now universal, and it will be felt by others. The issue needs to be addressed generically and for everyone. |
The API tracking solution has been in place in this repo for a month or two. You'll see .json files in the repo that capture the public API surface, and a corresponding analyzer that understand these files and updates them as needed. |
ℹ️ Review commit by commit
Microsoft Reviewers: Open in CodeFlow