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

Visual Studio Code not displaying warnings or errors #2739

Closed
markvincze opened this issue Jul 7, 2018 · 3 comments
Closed

Visual Studio Code not displaying warnings or errors #2739

markvincze opened this issue Jul 7, 2018 · 3 comments
Labels

Comments

@markvincze
Copy link

markvincze commented Jul 7, 2018

I created a sample .NET Core project (a class library targeting netstandard2.0) to try StyleCopAnalyzers, and I intentionally made some violations in the code.

I added a reference to StyleCopAnalyzers, and I immediately can see the warnings on build:

dotnet build
Microsoft (R) Build Engine version 15.7.179.6572 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 33.55 ms for C:\Workspaces\Github\CodeStyleCheckSample\src\CodeStyleCheckSample\CodeStyleCheckSample.csproj.
MyClass.cs(27,18): warning SA1402: File may only contain a single class [C:\Workspaces\Github\CodeStyleCheckSample\src\CodeStyleCheckSample\CodeStyleCheckSample.csproj]
MyClass.cs(1,1): warning SA1633: The file header is missing or not located at the top of the file. [C:\Workspaces\Github\CodeStyleCheckSample\src\CodeStyleCheckSample\CodeStyleCheckSample.csproj]
...

Or, if I add the <TreatWarningsAsErrors>true</TreatWarningsAsErrors> flag to the csproj, then they show up as Errors.

If I open the solution in Visual Studio, I can nicely see the warnings or errors show up as squigglies.

image

But if I try it in Visual Studio Code, then I don't see any of these, regardless of whether I set TreatWarningsAsErrors to true or not.

image

On the other hand, if I make an actual syntax error, that immediately shows up, so the C# integration itself is working properly.

image

Do you know what I might be doing wrong, or what setting I should change to make the analyzer errors show up in VSCode?

@mvestergaard
Copy link

I don't think roslyn analyzers are supported by VSCode/OmniSharp (dotnet/vscode-csharp#43)

@sharwell
Copy link
Member

sharwell commented Jul 8, 2018

Thanks for the link @mvestergaard 😁

@markvincze
Copy link
Author

Thanks for the info!

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

No branches or pull requests

3 participants