How disable error warnings in Visual Studio Code? [duplicate] - c#

The below popups have started showing up recently in vscode. Is there a way to turn these off? I couldn't find an option for it in settings.json
I already use the problems menu in vscode a lot which has a full list of warnings/errors, so I don't need an additional popup telling me what's wrong.

I posted the answer below back in July and then an overeager moderator deleted it today:
I believe this error is coming from an extension you have installed. Please try tracking down which extension is the root cause and opening an issue against them
This is the correct answer and the poster found that the prettier extension was causing this issue.
We do not provide a means to turn off or suppress these error messages because they are errors and will impact the VS Code experience. If you are seeing an error, file an issue against the extension that is causing it or VS Code itself if you believe the issue is not caused by an extension

Related

Viewing all 'suggestions' in a solution

Newbie question, I've just switched from Visual Studio to Rider, so I'm still trying to get my bearings.
Trying to use the code analyzers and see the suggestions for the entire solution.
The errors/warnings I can see in the 'Errors In Solution' window but the suggestions are not listed there. Can I add them to that list somehow?, or is there a different window?
Edit:
It's not just the Roslyn analyzers, for example a spelling mistake shows up highlighted in the source as as 'suggestion'.
When opening the 'Errors in Solution' I would have expected those to also be there but they aren't.
You should just need to enable them.
See Rider Roslyn Analyzers settings for the docs.
#jdphenix gave a link in the documentation where I was able to continue reading and found the answer.
The docs in question can be found here:
https://www.jetbrains.com/help/rider/Reference__Windows__Inspection_Results.html
First I had to do "Code => Inspect Code...", select solution and only after that an "Inspection Result" window becomes available, that's where it's listed.
Not very user friendly for new users :)

Ambiguous reference intellisense error from Resource.Designer.cs

I am running into a peculiar bug when developing on Visual Studio 2017 that I have been able to ignore for a while, but is now beginning to really bug me.
I refer to this issue as a bug rather than an error because I am still able to build my projects in Visual Studio and deploy them to my development device without errors or warnings from the build output. This might seem alright to ignore for a bit, but over time it has become an issue because my intellisense is underlining it in red as an error
every time I reference attributes from the Resource class. As you might guess, I refer this class a lot and the Visual Studio editor eventually becomes cluttered with these "errors" which (a) hinders my ability to find actual errors in my code and (b) irritates me beyond all reason...
"Error" Investigation
As shown in the last image, intellisense is picking up an "Ambiguous Reference" to each attribute in the Resource class. When I check my Resource.Designer.cs file I only see one reference, but get a second error
.
It is now telling me that that a "Member with the same name is already declared". This lead me to believe that there is a second Resource.Designer.cs file, but my solution explorer and windows explorer both show only one.
Attempted solutions
Changed the namespace from InventoryApp (the default namespace of the file) to InventoryApp.Resources. This rid me of the ghastly errors but, upon building the project, it reverts the namespace in the file back to it's default, and the errors pop back up. I was also told by somebody who knows better that this is a big no-no.
Deleted the Resource.Designer.cs file, deleted the "obj" and "bin" folders from the project, cleaned and rebuilt the solution, then added the new Resource.Designer.cs file back to my solution. This did nothing to solve the problem.
Created an entirely new project from scratch. Even after creating a Blank Android App from the Visual Studio templates, the error persists. This begs the question: Is this a problem with my installation of Xamarin.Android?
Side-notes
The Resource.Designer.cs file's Build Action is set to "Compile"
The .csproj config file contains the tags:
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
<AndroidResgenClass>Resource</AndroidResgenClass>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v7.1</TargetFrameworkVersion>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
6/6/2018 Update
If you have ReSharper, you most likely will be able to disregard my per-project solution described below and, instead, simply install the latest version (currently ReSharper 2018.1.2). Apparently, the underlying issue was caused by a bug in a previous version. Upgrading resolved the issue for me.
See youtrack.jetbrains.com/issue/RSRP-469636 for more information.
Thanks to #davidbauduin over at Xamarin Forums for this information.
I believe I have figured out the underlying issue and have a viable solution.
Solution
Add the following to the <PropertyGroup> section in your .csproj file:
<AndroidUseManagedDesignTimeResourceGenerator>False</AndroidUseManagedDesignTimeResourceGenerator>
Reason
While previous versions of Visual Studio had that feature turned off by default, the latest VS2017 update (15.7.3) has it turned on. That feature generates a second Resources.Designer.cs file that results in the ambiguous reference issue.
You can verify by hovering over the resource constant with the Intellisense error, right-clicking, selecting "Go To Definition", and selecting the 1st item, which takes you to a Resource.Designer.cs file. If you repeat, but select the 2nd one, you'll be taken to a different Resource.Designer.cs file. One of these points to the obj\Debug\designtime\Resource.Designer.cs file. By setting that feature to False as described above, that Resource.Designer.cs file in the obj\Debug\designtime path will not be generated.
Information Regarding the AndroidUseManagedDesignTimeResourceGenerator Feature:
https://developer.xamarin.com/releases/android/xamarin.android_8/xamarin.android_8.1/#design-time-builds-managed-resource-parser
https://github.com/dotnet/project-system/blob/master/docs/design-time-builds.md#design-time-builds
Hope this helps!

VS 2017 immediate window shows "Internal error in the C# compiler"

I use Visual Studio 2017 (15.6.6). When debugging, I try to evaluate simple expressions like int a = 2; in the immediate window. An error
Internal error in the C# compiler
is thrown.
I tried to enable Use Managed Compatibility Mode as hinted at in this question but it didn't help.
Thanks for any help.
Searching further I found this issue on GitHub where an answer recommends to also check Use the legacy C# and VB expression evaluators. Visual Studio gives me a warning about checking this option, but turning this on I can evaluate expressions in the immediate window again.
It is even possible to turn off the Use Managed Compatibility Mode again.
Update: Notice though that using the legacy expression evaluators prevents me from inspecting local variables at debug time, so I wouldn't call it a solution.
In my case, the problem was occurring in a particular assembly. When we looked at the assembly information, (from the Solution Explorer, right click on project, select Properties, then click on Assemble Information), it was all blank.
So we gave it a Guid, then re-built and it worked.
I had the same issue. Don't know if it's your option but for me it was the next issue: instead of "Debug" version the "Release" was turned on. So as soon as I switched back to debug I got rid of this error.
I've got the same error when deal with own NuGet package.
In my case VS resolve a path to the copy of my assembly in "%userprofile%.nuget" folder instead of build output folder.
Currently, I don't known how to prevent this miss-resolving for new project types, where no hint is specified for references, but there's simple workaround: just remove unpacked copy of package from %userprofile%\.nuget\packages\%yourpackage% before debug.
It is happening in Visual Studio 2022 17.3.2 too and it can be found "Closed, not enough info" on feedback hub. As always, incompetent outsourced india strikes again.
Anyway stopping debugging and rebuilding solution works. It have something to do with completely f****d and useless Hot Reload.
Clearing the directory C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files solved the issue for me. I'll try to build a repo if the issue appears again...

The name '###' does not exist in the current content (wave of these on every page)

When any .cs page is opened a slew of "does not exist..." errors show up with an occasional "are you missing a using directive or an assembly reference?"
Although these errors appear, the project can build and run just fine. I can even step through the code. In fact when it is built the errors go away.
Once the run has ended, adding a new page will generate all the same messages for that page and any previous one opened that session.
I have done several searches but these error seems fairly generic and I have not found an answer that works for me just yet.
EDIT: A bit of elaboration on when it first showed up might help - My coworker made some changes by adding a brand new aspx page to our project while I fixed a code issue on a separate page. We used Source Safe go get his changes into my project. Ever since we used Source Safe it seems some configuration was changed with Visual Studio. Both our projects worked fine on separate machine, but now neither runs without these errors.
I have the same issue. I have VS2008 professional. After installing SP1, my copy of VS2008 now generates huge amounts of "does not exist" errors. The code is absolutely perfect, the errors are false reports. If I rebuild, all of the errors disappear. However, simply typing 1 character into any open .cs file will bring back all the errors. They do not go away after waiting.
Other people reporting this bug, say that double clicking an error makes it go away. Not the case for me however.
This is deffo a bug in VS2008SP1. It has to do with the background compilation not working or something. Anybody else have the same issue?
This might fix the issue:
http://blogs.msdn.com/b/kevinpilchbisson/archive/2008/10/30/hotfix-for-vs2008-sp1-available.aspx
Haven't tried it yet.
Anybody have this issue, clearly a BIG problem with VS2008SP1?
OK, I fixed it. I simply deleted the SUO file for my web project. The strange behaviour "seems" to have gone now for this project.
Before deleting the file I noticed that there were lots of breakpoints set up and each of these breakpoints had lots of "sub breakpoints". Don't know what that was all about, but it looked odd.
But deleting the suo file tidied all of this up. Breakpoints look OK now. Breaks and steps OK. Live semantic markup is OK. At least for the moment!
If you are getting issues, try deleting the suo file. Won't always work but is worth a try...

Resharper: Cannot resolve symbol 'Eval' in VS2010 SP1

I just installed SP1 for VS2010, and since then I get error messages from Resharper for stuff that used to work and be ok for Resharper (5.1) before.
The error messages are "Cannot resolve symbol 'Eval'" and some other methods other than Eval.
How do I solve this?
Is there a fix?
Is there some resharper cache that I must delete/clear?
(The code compiles and runs as usual)
I would try deleting the _ReSharper.{SolutionName} directory completely if clear cache fails.
You might want to close VS2010 before you do that.
EDIT: Try this only if #Andrew Finnell solution doesn't work.
Try:
Resharper Menu -> Options -> General -> Clear Cache button
I had this problem in spades in my multi-project VS solution. Tried Julien + Andrew's solutions and they did not resolve the issue. But everything compiled just fine and worked as normal -- it was simply the "Errors in Solution" that kept showing the errors (which also showed up when you looked at the code in the right-hand-ReSharper-margin).
It turns out I had inadvertently deleted the web.config file in one of the solution's web projects during some version control operations. Who knew that thing was important?
I restored the web.config file, cleared the cache and deleted the R# cache directories and then rebuilt all of the projects individually and the issues went away.
Phew!
The solutions of #Andrew Finnell and #Julien Bérubé, alone and combined, did not fix my problem of "Cannot resolve symbol".
The comment of #bdwakefield pointing to here finally shed light on my problem.
It turns out that my "not resolved symbol" contains a web reference, and ReSharper gets lost there somehow.
By the link above it is possible to see that this is also an issue for many people, but JetBrains guys were not able to reproduce the error until now (see here).
I was having the same problem with one of my projects. I reported the issue to JetBrains and they requested a VS solution which has the problem.
So, I decided to spend a few hours trying to narrow down the problem as much as possible. I found out that the issue is related to a tool I use which strips out information from .DLLs.
If I don’t strip the .DLLs, Resharper works fine without showing any “cannot resolve symbol” errors. However, If I do strip the .dll, then ReSharper starts to show these “cannot resolve symbol” errors. In both cases, Visual Studio compiles the program and the program runs fine.
I am working with JetBrains to get the issue resolved.
In the mean time, I am able to workaround the problem by using versions of my .DLLs which do not have any information stripped out of them.

Categories

Resources