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

Microsoft.CodeAnalysis.NetAnalyzers do not find issues in VSTO Excel Add-in #77609

Open
ShaunLoganOracle opened this issue Mar 14, 2025 · 1 comment
Assignees
Milestone

Comments

@ShaunLoganOracle
Copy link

ShaunLoganOracle commented Mar 14, 2025

Version Used:
Visual Studio 2022 17.12.5
Microsoft.CodeAnalysis.NetAnalyzers 9.0.0
.NET Framework 4.8

Steps to Reproduce:

  1. Create a VSTO Excel Add-in using VS22 Create Project wizard's "VSTO Excel Add-in" project template
  2. Install NuGet package: Microsoft.CodeAnalysis.NetAnalyzers (packagereference)
  3. Enable code analysis ("Microsoft All Rules" ruleset) by adding to CSPROJ file:
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
 <EnableNETAnalyzers>true</EnableNETAnalyzers>
 <AnalysisLevel>latest</AnalysisLevel>
  1. Add some methods/properties that should general CA warnings (sample code provided on demand)
  2. From VS22 menu, run Analyze > Run Code Analysis > On Solution

Expected Behavior:
I expect to see CA warnings generated for using out object foo in a method argument (among others);

Actual Behavior:
the Output Window and Error List window don't show any CA warnings

Other Notes
I am trying to use this NuGet package CA approach since FxCopCmd stopped working in VS22 17.10.x (approx). See GH thread #74228

I do see %userprofile%Microsoft.CodeAnalysis.NetAnalyzers\9.0.0<many files> so I know that the package is accessible.
PackageReference in CSPROJ file:

  <ItemGroup>
    <PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers">
      <Version>9.0.0</Version>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
  </ItemGroup>
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead labels Mar 14, 2025
@arunchndr arunchndr added Bug and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Mar 14, 2025
@arunchndr arunchndr added this to the .NET 10 milestone Mar 14, 2025
@ShaunLoganOracle
Copy link
Author

@arunchndr , @sharwell -
Thanks for any attention you can give this issue - we are currently blocked from using Code Analysis for our add-in solution.

I see that this bug was added to the .NET 10 milestone. If that means a fix will be considered for the next release (.NET 10), then that won't work for us as we have to use .NET Framework for our VSTO add-in. If that milestone means something else, then fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants