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

VSCode Omnisharp - Multiple failures to suppress #111

Closed
Gryhyphen opened this issue Sep 26, 2020 · 1 comment
Closed

VSCode Omnisharp - Multiple failures to suppress #111

Gryhyphen opened this issue Sep 26, 2020 · 1 comment
Labels
other project This issue is not related to this project

Comments

@Gryhyphen
Copy link

Bug description

  • Version of analyzers assembly: 1.8.2
  • Analyzer rule: USP0006, USP0004, USP0003, probably others
  • Error (exception message, type, and callstack where applicable): Fails to suppress rules

To Reproduce

Steps or code to reproduce the behavior:

  1. Install vscode, unity and the right .net sdk
  2. Install C# extension, Debugger for Unity and NuGet Packet Manager
  3. Create a unity project, select vscode as editor and generate a project for code hinting setup stuff.
  4. For some inexplicable reason, make sure you have visual studio installed (with the unity workload) and make sure the project/solution is aware of it. You do not need to be logged in to VS.
  5. Enable royslin analyzers following this guide: https://www.strathweb.com/2019/04/roslyn-analyzers-in-code-fixes-in-omnisharp-and-vs-code/
  6. Using NuGet Packet manager, download/install Microsoft.Unity.Analyzers > 1.8.2
  7. Run dotnet restore <solution_name> (Command should come with .net sdk)
  8. Restart omnisharp.
  9. Create some example scripts/monobehaviours.

Expected behavior

I expect the rules to be suppressed. Other rules such as UNT0008 do show up.

Screenshots

IDE0051 - Not suppressed by USP0006 (Although, I don't actually understand this rule because I don't understand why an unused private variable is useful)
IDE0044 - Not suppressed by USP0004
image
IDE0051 - Not suppressed by USP0003
image
Success of UNT0008
image

Additional context

I'm working on setting up code guidelines and linting for my team. I'm focusing on roslyn/omnisharp support for VS and VS Code, but I think that roslyn/omnisharp can be used by other editors and just roslyn CI? (Although not 100% sure what CI is as I've never had a chance to work on a project with it - but someone on my team might be interested in it).

From what I understand, anything outside of Visual Studio technically isn't supported by this project, but I'd still like to get this working if possible.

Not sure what is going on with needing VS installed, and not sure if the unity workload is needed or just a C# workload, but either way I think it's odd that the thing won't work in VS Code unless VS is installed and the project files know about it.

Got the idea to try installing the analyzer based on: https://community.sonarsource.com/t/add-c-support-for-vscode-sonarlint/5888

Thought that if sonarlint could do it, no reason why other analyzers on NuGet couldn't either.

@sailro
Copy link
Member

sailro commented Sep 26, 2020

Hello @Gryhyphen, yes we are aware of this, but the bug is not on our side but rather on the omnisharp side.

We are tracking this original issue here:
OmniSharp/omnisharp-roslyn#1711

So currently, analyzers are working (UNT*), but suppressors (USP*) are not.

Thanks!

@sailro sailro closed this as completed Sep 26, 2020
@sailro sailro added the other project This issue is not related to this project label Sep 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
other project This issue is not related to this project
Projects
None yet
Development

No branches or pull requests

2 participants