roslyn icon indicating copy to clipboard operation
roslyn copied to clipboard

Suppress No Longer Showing in Error List

Open vsfeedback opened this issue 1 year ago • 28 comments
trafficstars

This issue has been moved from a ticket on Developer Community.


[regression] [worked-in:17.9] Since updating to Visual Studio 2022 Version 17.10.3 "Suppress" does not show up in the Error List context menu.

Suppress Message.png


Original Comments

Feedback Bot on 6/26/2024, 00:18 PM:

(private comment, text removed)


Original Solutions

(no solutions)

vsfeedback avatar Jul 01 '24 21:07 vsfeedback

This is a known limitation with LSP not supporting suppression states. In the interim suppression via lightbulb is still a workaround.

arunchndr avatar Jul 01 '24 21:07 arunchndr

PR removing command handler code here: https://github.com/dotnet/roslyn/pull/74266. (NOte the code to actually apply the suppression still exists. if we do an LSP handler here, it would call into that).

CyrusNajmabadi avatar Jul 03 '24 21:07 CyrusNajmabadi

I hope these can be fixed before the November release! Using the Light Bulb slows things down.

RealDotNetDave avatar Oct 08 '24 20:10 RealDotNetDave

This is still not showing in v17.12.0

goldcanyon340 avatar Nov 17 '24 00:11 goldcanyon340

This is still not showing in v17.12.0

This is in the backlog

CyrusNajmabadi avatar Nov 17 '24 00:11 CyrusNajmabadi

Closing out as we do not intend on bringing this back based on the low valume of feedback here and high complexity of implementation. 'supress' can be handled through the lightbulb now.

CyrusNajmabadi avatar Nov 26 '24 02:11 CyrusNajmabadi

This is disappointing. This just makes this process take longer using the lightbulb.

RealDotNetDave avatar Jan 16 '25 22:01 RealDotNetDave

Keeping this open to gather votes for a little while.

arunchndr avatar Jan 22 '25 18:01 arunchndr

How do we vote "yes PLEASE"? :-)

inthemedium avatar Jan 22 '25 22:01 inthemedium

Thumbs up the main post.

CyrusNajmabadi avatar Jan 22 '25 22:01 CyrusNajmabadi

Please restore the previous functionality. Once we upgraded VS 22 from 17.8 to 17.11, our use case (VSTO Add-in for Excel, .NET Framework 4.8, FxCopCmd.exe) is completely broken for Code Analysis:

  1. All CAnnnn warnings are shown in the VS 22 Error List - even those that have been suppressed in the source code (for example using: [System.Diagnostics.CodeAnalysis.SuppressMessage ("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]) - the SuppressMessage attributes are being ignored. This makes it very hard to distinguish between previously suppressed issues and new issues.
  2. For any CAnnnn issue shown in the Error List window, there is no longer a right-click (context) menu choice to Suppress. Using the Light-bulb workaround suggested above does not work for us, since that suppresses the IDEnnnn message, not the CAnnnn message (so the latter still shows in the Error List).

ShaunLoganOracle avatar Jan 31 '25 15:01 ShaunLoganOracle

It is very frustrating that this functionality has been removed

goldcanyon340 avatar Feb 04 '25 05:02 goldcanyon340

not the CAnnnn message

This we think is a bug. We are investigating. @ShaunLoganOracle

arunchndr avatar Feb 04 '25 19:02 arunchndr

@ShaunLoganOracle your issue of error list showing suppressed issues was fixed in 17.12. Please try upgrading and let us know if you still see issues.

arunchndr avatar Feb 11 '25 18:02 arunchndr

@arunchndr I upgraded to VS2022 17.12.5 and I still see both issues previously reported:

  1. Suppressed build CA Warnings are appearing in the error list (screen shot below)
  2. Right-click menu in Error List does not have the Suppress (in Code) menu item

Image

ShaunLoganOracle avatar Feb 12 '25 20:02 ShaunLoganOracle

Does the lightbulb on the item (in source code) have an option to suppress that issue (at the document, or solution level)?

CyrusNajmabadi avatar Feb 12 '25 20:02 CyrusNajmabadi

Does the lightbulb on the item (in source code) have an option to suppress that issue (at the document, or solution level)?

No. There is no lightbulb in the left-hand gutter. There is a screwdriver:

Image

If I right-click on the method and choose the light-bulb (Quick Actions and Refactorings), I don't see any option to suppress:

Image

ShaunLoganOracle avatar Feb 12 '25 20:02 ShaunLoganOracle

Oh duh. Because it's already suppressed. Brain fart. We will look into why these suppressed items are showing up in the error list. @dibarbet can you ptal?

CyrusNajmabadi avatar Feb 12 '25 20:02 CyrusNajmabadi

@ShaunLoganOracle - to confirm, these look like legacy fxcop errors that are produced on build (FxCopCmd.exe), correct? Can you confirm if the output from the "Build" tab reports the suppressed errors in 17.12 (and share a snippet)? I would expect it to not report them.

For example, in my 17.12 instance with a suppression (note no CA1032 reported)

Image

And no error in the error list as expected.

Commenting out the suppression leads to the error being reported.

Image

There's a number of ways errors can be reported, so just trying to track down the source. Thanks!

dibarbet avatar Feb 13 '25 00:02 dibarbet

@dibarbet Yes, those are FxCopCmd.exe build errors. More background in the post above.

Yes, if I change the filter from "Build+Intellisense" to "Build Only" I still see the CA1007 that is suppressed in source via a [SuppressMessage] attribute in the Error List window.

Image

Note also that in the Error List window, the "Code" and "Suppression State" columns are blank for this issue - is that a clue?

VS22:

Image

ShaunLoganOracle avatar Feb 13 '25 15:02 ShaunLoganOracle

Yes, if I change the filter from "Build+Intellisense" to "Build Only" I still see the CA1007 that is suppressed in source via a [SuppressMessage] attribute in the Error List window.

To clarify, I meant do you see it in the text output in the "Output" window under the "Build" dropdown? If you could share a small snippet of what you see for an affected project that would be useful

dibarbet avatar Feb 13 '25 18:02 dibarbet

Yes, the CA1007 warning appears both in the Error List window as the previous screen shots show, and also in the Output window with "Build" selected as seen here:

Image

ShaunLoganOracle avatar Feb 13 '25 18:02 ShaunLoganOracle

@dibarbet , @CyrusNajmabadi , @arunchndr - is there any progress/update for this? Thanks.

ShaunLoganOracle avatar Feb 26 '25 12:02 ShaunLoganOracle

It's being discussed/considered. Thanks

CyrusNajmabadi avatar Feb 26 '25 12:02 CyrusNajmabadi

Responding specific to @ShaunLoganOracle's case: The scenario covered there seems to be the legacy analysis via FxCopCmd that is not supported anymore and has since been replaced with source analysis via .NET analyzers which is usable from the SDK or nuget depending on your nuget version. Refer to https://learn.microsoft.com/en-us/visualstudio/code-quality/install-net-analyzers?view=vs-2022

Also see https://learn.microsoft.com/en-us/visualstudio/code-quality/migrate-from-legacy-analysis-to-net-analyzers?view=vs-2022/ for the migration instructions.

arunchndr avatar Mar 07 '25 00:03 arunchndr

Thank you, @arunchndr .

We’d be glad to use the new analyzers, but it is not possible with a VSTO solution. So, until it is a possible to use the new analyzers with a VSTO solution, the old system using FxCopCmd must continue to work.

ShaunLoganOracle avatar Mar 10 '25 15:03 ShaunLoganOracle

Roslyn analyzers should still work on netframework.

use the new analyzers, but it is not possible with a VSTO solution

So there seems to be more to this that we need to understand. Would you elaborate on what doesn't work in the vsto+roslyn analyzer combo?

arunchndr avatar Mar 12 '25 22:03 arunchndr

@arunchndr I created a new thread #77609 with details.

ShaunLoganOracle avatar Mar 14 '25 19:03 ShaunLoganOracle

It's very disappointing that this feature has gone away, and from a personal point of view I do consider this a bug. It slows working with Code Analysis Suppressions down considerably, especially with big solutions with many projects. The alternative is people disabling rules and this will result in CA being used less and less. I do not understand the audacity of even discussing if a fix should be implemented while in the Feedback Program people clearly do say that they miss the functionality.

marco-bertschi avatar Jul 11 '25 11:07 marco-bertschi

When is this going to be put back to the Error Window? This removal (I have no idea why) is causing us to spend a lot more time suppressing code violations. Please put it back for the Novemer release!

RealDotNetDave avatar Jul 29 '25 14:07 RealDotNetDave