dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.85k stars 669 forks source link

Allow suppression of project load failures #7472

Open estenio12 opened 3 weeks ago

estenio12 commented 3 weeks ago

First I checked vscode to not show me notifications from the extension, but it still continued to appear; Then I went and marked it to not show any notification, only notifications from this extension are going over my configuration and showing the notification.

The big problem is when the extension detects a problem, and then starts reporting the same error over and over again.

Image showing any notification is turned off: Erro C# extensions on VSCode

Image showing C# extension notification is turned off: C# extensions on VSCode marked as off

Image showing my extension installed for C#: My Extensions installed for C# workflow

dibarbet commented 3 weeks ago

VSCode doesn't allow error messages to be hidden (intentional design decision on their side). I'm not 100% sure if it covers this case, but @estenio12 can you try enabling dotnet.server.suppressLspErrorToasts in VSCode settings to see if that suppresses the toast?

Just an FYI - the error you're seeing indicates there was an issue loading the project. If that error is present you may see limited language feature support for anything that is a part of that project.

estenio12 commented 3 weeks ago

Hi @dibarbet!

I did what you recommended, but it didn't work. I checked the box and restarted vscode and it didn't work.

Image showed my setting: Setting Vscode

Answering the question of explaining the problem you explained, what happens: The solution of this project has references from several other different projects, the configuration of task.json and launch.json are customized to execute only what I want to debug.

Maybe a solution for this problem is load sln of extension instead of using my custom launch.json, i will try latter.

dibarbet commented 3 weeks ago

Got it, we'll see if we can do something to suppress the project load notifications as well. But it likely won't happen immediately.

There are also a couple things you can do if you want the C# extension to ignore certain aspects of the projects when loading them, for example

  1. Use a solution filter (slnf) to include only certain (working) projects (slnf files should be available in the 'Open Solution' command).
  2. Use MSBuild properties to control when certain things are run. For example if you don't want something to happen when the projected is loaded in VSCode for intellisense, you can condition it using the $(DesignTimeBuild) property (which is set to true when the C# extension is loading the project).