Open bitbonk opened 2 years ago
https://github.com/dotnet/roslyn-analyzers/pull/4992 should be fixing this. I'll try to get it completed and merged soon.
@Youssef1313 Any update on this? I tested this in 3.3.4 and the problem is still present (this time a constructor was made protected without a warning).
Analyzer
Diagnostic ID: RS0016:
Add public types and members to the declared API
and/or RS0017Remove deleted types and members from the declared API
Analyzer source
NuGet Package: Microsoft.CodeAnalysis.PublicApiAnalyzers
Version: 3.3.3 (Latest)
Describe the bug
The analyzers do not detect changes when a once public member of a public class was changed to a protected member in the same class.
Steps To Reproduce
Microsoft.CodeAnalysis.PublicApiAnalyzers
.Expected behavior
I get an analzer warning warning (RS0016 and RS0017) that the API is missing.
Actual behavior
No warnings happen.
Additional context
In our concrete case, we had this in
PublicAPI.Shipped.txt
Some.Namespace.BootstrapperBase.Initialize() -> void
After we changed
Initialize()
from public to protected in the .cs file no analyzers were summoned.It looks like the public/protected access modifiers are not part of the text files and are generally ignored but changing them will cause breaking changes too. I would think that protecting us from breaking changes in the public API is the whole idea behind
Microsoft.CodeAnalysis.PublicApiAnalyzers
.