-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Microsoft.CodeAnalysis.PublicApiAnalyzers disabled after moving to .NET 7 #7903
Comments
@rainersigwald has an idea for a modern alternative: PackageBaselineValidator. EnablePackageValidation=true and some baseline version (whatever the last shipped one was). |
Update target framework in MSBuild and related places (consolidating MSBuild references). Add NoWarn for deprecation warnings (#7902) and API-stability analyzer problems (#7903). Fix a issues around crypto API simplifications on .NET Core spotted by new analzyers. Co-authored-by: Rainer Sigwald <[email protected]>
cc @jaredpar we're not sure if this is an actual roslyn bug we should file in the repo. |
What's happening is: An analyzer has weird behavior after this retargeting. That analyzer happens to be owned by Roslyn. We're not sure if this is a compiler problem (it's running the analyzer funny and it's producing garbage results) OR it's an analyzer problem (being called correctly but is wrong) If it's the latter, we should use the modern solution. |
@jaredpar, @masavani, @jmarolf Build.txt I got this by deleting the contents of all the PublicAPI.Shipped.txt files then trying to build. Note that although there are only 9 errors, if I try resolving just those instances (like with #pragma warning disable flags), others pop up. |
So far these results make sense to me:
You should get the same error for each TFM in a multi-tfm project because there are that many compilations happening |
@benvillalobos @Forgind what are the repo steps? I cloen MSBuild, do a build with the repo targeting .net 6 and then do another targeting .net7? |
No retargeting necessary. I'm not worried about there being multiples of a single line; as you say, that part is expected. My confusion is around why RS0026/RS0027 should pop up after deleting the contents of the public api files but not before. In any event, the more clearly wrong behavior is around RS0016 and RS0017. We currently NoWarn those in Directory.Build.props. If you remove those NoWarns and try building, you'll get those to pop up, saying things are part of the public API but cannot be found. On the other hand, if you open Visual Studio (with the NoWarns removed) and look at, for example, NativeMethods.IFixedTypeInfo.ReleaveVarDesc, it has the green squiggle saying it isn't part of the declared API and should be. Those two statements are directly contradictory. |
Yeah, there we go
|
hmm, looking at the binlog it doesn't appear that the path to the PublicAPI.Shipped.txt/PublicAPI.Unshipped.txt files is correct in your build:
I assume these should be absolute paths? msbuild/src/Directory.Build.targets Lines 98 to 99 in a440ea9
|
nevermind the existing targets are correct |
@jmarolf, what's the status on this? Just want to make sure you have everything you need to continue investigating. |
We moved to Dotnet SDK integrated code analysis, so we do not need this anymore. |
Issue Description
Transitioning MSBuild to net7.0 has raised strange issues from roslyn api analyzers. RS0016 and RS0017 come up as issues but the issues don't seem to make sense. The complaints are about API's not existing (despite them existing). Maybe I'm missing something.
The text was updated successfully, but these errors were encountered: