Skip to content

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

Closed

Description

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.

Activity

  1. martincostello commented on Sep 1, 2024

    @martincostello
    ContributorAuthor
  2. martincostello commented on Sep 1, 2024

    @martincostello
    ContributorAuthor

    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

Metadata

Metadata

Labels

type:bugA broken experience

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions