Skip to content

[BUG] C# build errors are not highlighted #2046

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

Open
tedbrownxr opened this issue May 27, 2025 · 4 comments
Open

[BUG] C# build errors are not highlighted #2046

tedbrownxr opened this issue May 27, 2025 · 4 comments
Labels
area-roslyn bug Something isn't working

Comments

@tedbrownxr
Copy link

Describe the Issue

In a C# Console project with known build errors (e.g. multiple errors shown when running "dotnet build"), no errors are shown in VS Code. You can even write random letters anywhere in the file: nothing shows up as a problem.

A reset of the project (removing sln, .vscode and re-opening) did not resolve the issue.
An update of the application and all related extensions did not resolve the issue.

This issue can be reproduced by creating a new project with:

dotnet new console
code .

Using:

  • Mac OS 14.1.1
  • VS Code 1.100.2
  • .NET Install Tool 2.3.5
  • C# Extension 2.76.27
  • C# Dev Kit 1.19.63

Steps To Reproduce

No response

Expected Behavior

No response

Environment Information

No response

@tedbrownxr tedbrownxr added the bug Something isn't working label May 27, 2025
@tedbrownxr
Copy link
Author

After reproducing this issue a few times in new projects, I returned to my original project. The situation somewhat resolved:

By selecting a file known to have an error, errors were shown. If a file with known errors was not opened, it would not show as having errors in the Explorer.

This issue appears to be coincide with a syntax highlighting issue that I was also writing a bug on, meaning that classes, methods, and variables were given the same color treatment.

I'm not satisfied with the fact that it "resolved itself" though. Something is broken.

@webreidi
Copy link

@tedbrownxr
We have noticed that in some instances, VS Code is not activating the extension or extension activation is delayed. This would cause the issues that you are references, and opening a file would kickstart the activation. When you experience these issues, can you check the status bar to see if the projects have loaded. You'll see "Projects: " in the status bar and it will list a number of projects loaded or will show the name of the project the current open file is in, like the image below.

Image

@webreidi webreidi added area-roslyn needs-more-info Needing more information, waiting on OP labels May 28, 2025
@tedbrownxr
Copy link
Author

Thanks, I'll keep an eye out. Naturally, everything is behaving right now.

Your comment explains another interesting symptom: when I open a project, such as a new project:

  • Syntax highlighting works while the "Projects" status bar is loading.
  • When the Projects status bar finishes loading, the syntax highlighting stops working (classes have the same color as methods).
  • When I click another file (e.g. the csproj file) and back to Program.cs, the syntax highlighting works again.

Before your comment, I could never quite understand what was triggering the "reset" of syntax highlighting. Now I can tell it's clearly something to do with the Project's loading status.

This issue is highly reproducible: you just have to fully exit Visual Studio between sessions, and call code . in the project folder.

@github-actions github-actions bot removed the needs-more-info Needing more information, waiting on OP label May 28, 2025
Copy link

@webreidi, the 'needs-more-info' label has been removed upon receiving further response from the original bug filer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-roslyn bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants