Skip to content

Use Microsoft.CodeAnalysis.PublicApiAnalyzers #24188

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

Merged
merged 3 commits into from
Jul 24, 2020
Merged

Conversation

dougbu
Copy link
Contributor

@dougbu dougbu commented Jul 22, 2020

nit: sort @(LatestPackageReference) a bit better

@dougbu dougbu requested review from pranavkm, JamesNK, ajaybhargavb and a team July 22, 2020 05:39
public static string GetPathByAction(
#pragma warning restore RS0026 // Do not add multiple public overloads with optional parameters
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ajaybhargavb @JamesNK I realize this and src/Mvc/Mvc.Core/src/Routing/PageLinkGeneratorExtensions.cs aren't particularly new. But, can this problem be addressed and not suppressed without breaking back-compat❔ If not, do you suggest we take the hit now❔

Copy link
Member

Choose a reason for hiding this comment

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

The only way to resolve the warning is changing method signatures which is a breaking change.

I don't know of any issues caused by the overloads. Suppressing is fine.

@javiercn

Copy link
Contributor

Choose a reason for hiding this comment

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

I would recommend using attribute-style suppressions for methods, with the Justification set to "Required to maintain compatibility".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That seems to work but VS tends to crash or ignore me when using attribute suppressions for this issue. I eventually got it to fix one instance and copied my brand new attribute everywhere else. Something may be busted in this area.

Copy link
Contributor

@JunTaoLuo JunTaoLuo left a comment

Choose a reason for hiding this comment

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

LGTM

@Pilchie Pilchie added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Jul 22, 2020
@Pilchie
Copy link
Member

Pilchie commented Jul 22, 2020

I suggest that once we fork for RC1, we move all of those items to the .Shipped files so that we can track any changes that happen.

@dougbu
Copy link
Contributor Author

dougbu commented Jul 22, 2020

I suggest that once we fork for RC1, we move all of those items to the .Shipped files so that we can track any changes that happen.

Agreed. Should I disable any other warnings from https://github.com/dotnet/roslyn-analyzers/blob/master/src/PublicApiAnalyzers/Microsoft.CodeAnalysis.PublicApiAnalyzers.md in the meantime❔

In my next PR, I need to

  1. add a small document covering planned use of these files and link to the documentation of the analyzer package
    • I'll include a note about RC1 plans here
  2. add lots o' PublicApi.*.txt files
  3. automate this infrastructure more e.g. provide a way to automatically add missing PublicApi.*.txt files and update them (if possible) from the command line

@Pilchie
Copy link
Member

Pilchie commented Jul 22, 2020

I don't think we want to disable any of the other warnings.

dougbu added 3 commits July 22, 2020 21:53
- #4259 1/2
- followup 2/3 for 5266918
- includes baselines for 16 MVC projects
    - will automated further additions in another PR
- suppress warnings that may cause back-compat problems if fixed

nit: sort `@(LatestPackageReference)` a bit better
@dougbu dougbu force-pushed the dougbu/analyze.apis.4259 branch from c8d9e16 to 700ed88 Compare July 23, 2020 19:50
@dougbu dougbu merged commit 918d953 into master Jul 24, 2020
@dougbu dougbu deleted the dougbu/analyze.apis.4259 branch July 24, 2020 16:45
@dougbu
Copy link
Contributor Author

dougbu commented Jul 27, 2020

Issue about the second item on my list is #24347. Please help if you have time.

@dougbu
Copy link
Contributor Author

dougbu commented Jul 28, 2020

A new version of Microsoft.CodeAnalysis.PublicApiAnalyzers containing @mavasani's dotnet/roslyn-analyzers#3916 improvement will address the last item on my list. We'll pick that up when it's ready.

Note: The new package will make missing PublicApi.*.txt files fail our builds because we treat warnings as errors. Anything left in #24347 will need to be done in one fell swoop unless we make use of the package conditional on the files existing.

Good news is we can probably delete

<AdditionalFiles Include="PublicAPI.Shipped.txt"
Condition=" Exists('$(MSBuildProjectDirectory)\PublicAPI.Shipped.txt') " />
<AdditionalFiles Include="PublicAPI.Unshipped.txt"
Condition=" Exists('$(MSBuildProjectDirectory)\PublicAPI.Unshipped.txt') " />
<AdditionalFiles Include="PublicAPI.Shipped.txt"
Condition=" Exists('$(MSBuildProjectDirectory)\$(_TFMDirectory)\PublicAPI.Shipped.txt') " />
<AdditionalFiles Include="PublicAPI.Unshipped.txt"
Condition=" Exists('$(MSBuildProjectDirectory)\$(_TFMDirectory)\PublicAPI.Unshipped.txt') " />
when using the new package.

@dougbu
Copy link
Contributor Author

dougbu commented Jul 28, 2020

Hmm, probably need to keep the $(_TFMDirectory) items for projects with slightly different public APIs per TFM.

@mavasani
Copy link

Hmm, probably need to keep the $(_TFMDirectory) items for projects with slightly different public APIs per TFM.

Yes, that sounds correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants