docs icon indicating copy to clipboard operation
docs copied to clipboard

We should add a note that CS0169 is a "Build-only" diagnostic

Open mavasani opened this issue 4 years ago • 4 comments

CS0169 warning is reported by the compiler only during explicit "Build" or "Rebuild" operations, it does not get reported during typing in the IDE, i.e. as part of intellisense diagnostics. This means that if the user edits code such that it fixes the warning OR deletes the unused field, the warning still remains in the error list and the corresponding stale squiggle also persists until the user builds or rebuilds the project again.

As this behavior is different from majority of compiler warnings/errors, which automatically refresh while typing, it leads to lot of user confusion. We have had multiple feedback tickets, such as https://developercommunity.visualstudio.com/t/CS0169-Warnings-do-not-vanish-after-prob/1551348, and adding this note to the doc page for this warning will likely help. We can also point to this documentation note while resolving such feedback tickets.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

mavasani avatar Oct 28 '21 11:10 mavasani

Another feedback ticket for the same issue: https://developercommunity.visualstudio.com/t/Intellisense-continue-reporting-errors-a/1547853

mavasani avatar Oct 28 '21 11:10 mavasani

Should also apply to all these warnings/errors?

https://github.com/dotnet/roslyn/blob/5c3f1e9ddadfc5c5190a5f283fd00db4b456ab78/src/Compilers/CSharp/Portable/Compilation/CSharpCompilerDiagnosticAnalyzer.cs#L43-L79

I'm also wondering what were the reasons for live error to not support this?

Youssef1313 avatar Oct 28 '21 17:10 Youssef1313

Related to #24002

BillWagner avatar Dec 07 '21 13:12 BillWagner

Reported again by a customer in https://github.com/dotnet/roslyn/issues/63164.

@BillWagner can we please add this documentation note for CS0169 first? Multiple users have now reported this issue for this ID.

mavasani avatar Aug 09 '22 01:08 mavasani

Reported again by a customer in https://developercommunity.visualstudio.com/t/Showing-suggestion-for-thing-that-is-no-/10150898, but for another build-only compiler diagnostic CS0649.

All the C# compiler error codes which are build-only diagnostics are listed here: https://github.com/dotnet/roslyn/blob/e263437db49b0650dbc72fca3331df654e05987c/src/Compilers/CSharp/Portable/Errors/ErrorFacts.cs#L531-L573 and will have the same behavior as CS0169. All the C# error codes are defined in this file.

We should update the documentation for all these error codes to add a note about them being build-only diagnostics.

mavasani avatar Sep 27 '22 14:09 mavasani

Tagging @arkalyanms as an FYI. We have been receiving quite a few VS user feedback reports for stale compiler diagnostic squiggles/error list entries for build-only compiler diagnostics, that can only be refreshed with explicit build/rebuild command and not from background analysis.

mavasani avatar Sep 27 '22 14:09 mavasani

Reported again by another customer at https://developercommunity.visualstudio.com/t/VS-2022-C-editor-has-gone-nuts/10162597.

Apart from this docs issue, I am also going to prioritize https://github.com/dotnet/roslyn/issues/64659.

mavasani avatar Oct 20 '22 08:10 mavasani