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

[BUG] Opening a solution with C# Dev Kit causes dotnet build to ignore .editorconfig analyzer settings #5885

Closed
Tracked by #5951
DavidZidar opened this issue Jul 2, 2023 · 11 comments
Assignees
Milestone

Comments

@DavidZidar
Copy link

Describe the Issue

I have multiple projects that build cleanly with no warnings using dotnet build at the CLI.

But after having opened them using Visual Studio Code with the C# Dev Kit extension dotnet build shows warnings that are clearly disabled in the .editorconfig file. Even after exiting Visual Studio Code I have to kill all dotnet.exe processes to make dotnet build build properly again.

Steps To Reproduce

  1. Disable some analyzer warning in .editorconfig, for example dotnet_diagnostic.CA1040.severity = none
  2. Open the solution using C# Dev Kit and watch it run restore
  3. Build using dotnet build at the CLI

Expected Behavior

Disabled warnings should not be displayed by dotnet build.

Environment Information

  • OS: Windows 11
  • VS Code Version: 1.79.2
  • Extension Versions: C# v2.0.248, C# Dev Kit v0.1.103

Workaround

Set the environment variable MSBUILDDISABLENODEREUSE=1, this does makes builds slower but they'll be correct.

@DavidZidar
Copy link
Author

DavidZidar commented Jul 2, 2023

I already reported this issue in microsoft/vscode-dotnettools#160 but since I feel that this is a pretty serious issue that seems to be ignored I am cross reporting here as well.

@arkalyanms arkalyanms added this to the Post GA milestone Jul 6, 2023
@arkalyanms
Copy link
Member

This is still in scope for pre C# Dev Kit GA, but post C# GA.

@DavidZidar
Copy link
Author

I've only been able to reproduce this issue with the C# Dev Kit extension running.

@mareklinka
Copy link

Hitting this issue as well, reproducing it is not 100% reliable. Running dotnet build-server shutdown resolves the issue temporarily. It feels like there might be a problem with build node reuse (if there is such a thing)? Also often reproduces when trying to run tests.

Historically, encountered this also in the old omnisharp-based extension but that's not super relevant now, I think,

@reynoldsa
Copy link

Is work on this currently planned? Unfortunately this is a pretty big blocker for me to use dev kit, as my team have a nontrivial editorconfig + warnings as errors configured, so this causes builds to fail.

@arkalyanms arkalyanms modified the milestones: Next, September Aug 21, 2023
@arkalyanms
Copy link
Member

Pulling into September opportunistically.

@mdsitton
Copy link

Any updates here? This is also causing issues for our team as well

@arkalyanms arkalyanms modified the milestones: September, October Oct 2, 2023
@DavidZidar
Copy link
Author

I am no longer able to reproduce this issue, it seems to have been fixed somewhere at some point. @richardstanton wasn't able to reproduce the issue either as of last week and just closed my original issue so I guess I better close this one too. If anyone can confirm they still have this issue with the latest SDKs I can reopen.

@definitelyokay
Copy link

I'm seeing this on macOS w/ Apple Silicon, C# extension version 2.14.8. I've added dotnet_diagnostic.IDE0022.severity = none to my .editorconfig for preventing single-line methods from being flagged for "Use expression body for method", but they're still showing up in the VSCode problems pane. Latest VSCode, clean installation even, .NET 8.

Enabling omnisharp respects the editorconfig. Unfortunately, I can't use omnisharp though because it tends to hang indefinitely/long time when trying to format code on save.

@mdsitton
Copy link

I am no longer able to reproduce this issue, it seems to have been fixed somewhere at some point. @richardstanton wasn't able to reproduce the issue either as of last week and just closed my original issue so I guess I better close this one too. If anyone can confirm they still have this issue with the latest SDKs I can reopen.

I had found that my issue ended up being an issue in my editorconfig so it could be a lack of error messages when this happens causing a lot of issues like this.

@thumpnail
Copy link

thumpnail commented Mar 12, 2024

@definitelyokay got the same issue. Enableing omnisharp as a language server solves this issue but i would prefer to be able to use c# dev kit tbh. it seems like when not using omnisharpls it reverts back to some sort of internal formatting options even when a .editorconfig is present. I could be missing a json setting in vscode but i am finding none.

edit: when omnisharp is disabled, is the config able to handle advanced .editorconfig entries like on microsofts website showed?

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

9 participants