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

EnforceCodeStyleInBuild causes IDExxxx diagnostics to be duplicated #2637

Open
rudism opened this issue Sep 3, 2024 · 0 comments
Open

EnforceCodeStyleInBuild causes IDExxxx diagnostics to be duplicated #2637

rudism opened this issue Sep 3, 2024 · 0 comments

Comments

@rudism
Copy link

rudism commented Sep 3, 2024

Environment

Running Void Linux, using the omnisharp-linux-x64-net6.0.zip package, launched by the neovim-lspconfig plugin.

Tested with both v1.39.12 and v1.39.13-beta.9.

$ dotnet --version
8.0.401
$ dotnet --list-sdks
8.0.401 [/home/rudism/dotnet/sdk]

Reproduce

Generate a new console project:

$ mkdir test
$ cd test
$ dotnet new console

Create a new omnisharp.json file enabling analyzers:

{
  "RoslynExtensionsOptions": {
    "enableAnalyzersSupport": true
  }
}

Edit Program.cs and do something that creates an IDExxxx diagnostic message (for example put a space somewhere it doesn't belong), observe a single diagnostic message:

image

Now edit the test.csproj file and add <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild> to the top PropertyGroup:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
  </PropertyGroup>

</Project>

Now edit Program.cs and observe the diagnostic message is duplicated:

image

Expected Behavior

It shouldn't be showing the same diagnostic messages twice even when enforcing code style analysis during the build.

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

No branches or pull requests

1 participant