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

CompilationWithAnalyzer.GetAnalyzerDiagnosticsAsync returns 0 diagnostics even though the analyzers do run & report #61851

Open
ujjwalchadha opened this issue Jun 13, 2022 · 0 comments
Assignees
Milestone

Comments

@ujjwalchadha
Copy link

ujjwalchadha commented Jun 13, 2022

Version Used: Microsoft.CodeAnalysis.Analyzers 3.3.2

Steps to Reproduce:

  1. Create a UWP Project
  2. Using a separate project that uses Microsoft.CodeAnalysis.Analyzers and at least one new analyzer that can provide some diagnostic on the UWP project, call CompilationWithAnalyzer.GetAnalyzerDiagnosticsAsync(token)

Expected Behavior: The call to function returns 1 diagnostic

Actual Behavior: The call to function returns 0 diagnostic, even though the analyzer does run an does create the diagnostic

BUT Adding TFM = net6-windowsXXX and Sdk="Microsoft.NET.Sdk" to the UWP project csproj (although invalid for UWP) fixes the issue where it returns the correct diagnostics that are reported.

This is happening at this line of the .NET Upgrade Assistant Project. Running our analyzers on a UWP project gives 0 diagnostic results while running this on a Net6 project gives the correct expected results.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead labels Jun 13, 2022
@vatsalyaagrawal vatsalyaagrawal assigned dibarbet and jmarolf and unassigned dibarbet Jun 13, 2022
@vatsalyaagrawal vatsalyaagrawal added Question and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Jun 13, 2022
@vatsalyaagrawal vatsalyaagrawal added this to the 17.3 milestone Jun 13, 2022
@arkalyanms arkalyanms modified the milestones: 17.3, 17.4 Oct 3, 2022
@arkalyanms arkalyanms modified the milestones: 17.4, 17.6 P3 Jan 17, 2023
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

5 participants