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

v1.6.19 adds dependency on Microsoft.VisualStudio.Threading analyzers #1810

Closed
martincostello opened this issue Sep 1, 2024 · 2 comments · Fixed by #1815
Closed

v1.6.19 adds dependency on Microsoft.VisualStudio.Threading analyzers #1810

martincostello opened this issue Sep 1, 2024 · 2 comments · Fixed by #1815
Assignees
Labels
type:bug A broken experience

Comments

@martincostello
Copy link
Contributor

Describe the bug

Version 1.6.19 of the Microsoft.OpenApi packages introduce a dependency on Microsoft.VisualStudio.Threading, which in turn is adding analyzers from that package into dependent projects.

This then causes build failures when the consuming project does not conform to any of the rules the analyzer introduces.

For example: martincostello/api#1967

Use "Async" suffix in names of methods that return an awaitable type (https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD200.md)

OpenApi File To Reproduce

N/A

Expected behavior

Analyzers from this project do not affect the consumers of Microsoft.OpenApi packages.

Screenshots/Code Snippets

N/A

Additional context

None.

@martincostello
Copy link
Contributor Author

Related: NuGet/Home#6279 (comment)

@martincostello
Copy link
Contributor Author

Workaround via Directory.Build.targets:

<Project>
  <Target Name="DisableVSAnalyzers" BeforeTargets="CoreCompile" Condition=" '$(RunStaticAnalysis)' == '' OR '$(RunStaticAnalysis)' == 'false' ">
    <ItemGroup>
      <Analyzer Remove="@(Analyzer)" Condition=" '%(Filename)' == 'Microsoft.VisualStudio.Threading.Analyzers' OR '%(Filename)' == 'Microsoft.VisualStudio.Threading.Analyzers.CSharp' " />
    </ItemGroup>
  </Target>
</Project>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug A broken experience
Projects
None yet
2 participants