eberthold / SteroidsVS

Visual Studio Extension
https://marketplace.visualstudio.com/items?itemName=eberthold.SteroidsVS
MIT License
25 stars 2 forks source link

Code Quality Hints ignores pragma warning disable #22

Closed twelve-cgn closed 3 years ago

twelve-cgn commented 4 years ago

Hello eberthold, as already written in the title, Code Quality Hints ignores the #pragma keyword. I do not know how difficult the exclusion would be, but I would be happy if it were corrected.

Thanks for the great extension.

eberthold commented 4 years ago

Hey, thanks for your feedback.

I think I need some more information as this is normally working as expected.

twelve-cgn commented 4 years ago

Hello eberthold, sorry for the delay...

eberthold commented 4 years ago

Sorry for late reply, but wasn't able to look into this issue earlier.

I constructed several cases to reproduce this issue, but every time I introduced the pragma, the warnings were gone as expected.

Maybe you could provide a small sample project which reproduces the issue?

twelve-cgn commented 4 years ago

Here is a screenshot of a standard console project where you can see everything so far: image

eberthold commented 4 years ago

A little update on my progress so far. I reproduced the issue with your sample, but I need some more time to investigate it. It seems that the way how the Error List Window provides the suppression information is not uniform for all cases.

I will update this issue as soon as I have some more clarity on whats so special with this warning type.

RealHabix commented 4 years ago

After upgrading to .net core 3.1, nothing from globalsupression.cs is suppressed (while vs's ErrorList is empty)

image

Seems extension "solution error visualizer" has same problem as it underlines warnings that should be supressed. What is even more wierd: the extension only underlines the warnings in files that are open in ide (all closed files look ok); build doesn't report any warnings.

eberthold commented 4 years ago

As far as I know most (all?) extension which crawl the error list face this problem in some way. The time consuming part with this issue is, that it´s an badly documented part of the Extension-SDK, so I need to work with decompiled sources to find the root of this issue. My Christmas holidays start mid of next week, maybe I find some time to look into this.

Some background: This extensions uses TableEntryExtensions.TryGetValue to gather all needed informations. Sadly the StandardTableKeyNames don´t provide all existing Keys. For Example for the suppression I´m currently using the key suppressionstate. Maybe they changed the key for some cases or introduced a new one which I am unaware of right now.

RealHabix commented 4 years ago

https://marketplace.visualstudio.com/items?itemName=AlexanderGayko.ShowInlineErrors this one still works after update (maybe it can help your track the problem)

eberthold commented 4 years ago

I tried to dig down deeper into this issue but had no success. Maybe @madskristensen or @davkean have some knowledge about this issue or know someone who can shed some light onto this. Would really appreciate some helping infos

eberthold commented 4 years ago

I found that it may be a regression in VS2019 because it is working in VS2017 as expected. I filed a feedback entry here https://developercommunity.visualstudio.com/content/problem/893837/vssdk-itableentry-suppression-state-not-accessible.html

maybe this will be working in a future release of VS2019 again. I will keep you updated as soon as I get some news

olegtk commented 4 years ago

"suppressionstate" filter was removed in 16.4. "suppression" should be a direct replacement though.

So starting with 16.4, you need to check StandardTableKeyNames.SuppressionState ("suppression") column and it's value is not a string, but an enum:

namespace Microsoft.VisualStudio.Shell.TableManager
{
    /// <summary>
    /// Value that indicates whether an error has been suppressed.
    /// </summary>
    /// <remarks>
    /// <para>
    /// Base type for the value returned when calling <see cref="ITableEntry.TryGetValue(string, out object)"/> and <see cref="ITableEntriesSnapshot.TryGetValue(int, string, out object)"/> using the
    /// <see cref="StandardTableKeyNames.SuppressionState"/> key.
    /// </para>
    /// <para>
    /// It is better, for performance reasons, to return values that have been boxed when returning though an out object. You can find boxed equivalents of these values in Microsoft.VisualStudio.Shell.TableManager.Boxes.
    /// </para>
    /// <para>
    /// Note that "suppressed" errors are still visible but they are filtered out by default.</para>
    /// </remarks>
    public enum SuppressionState
    {
        Active = 0,
        Suppressed = 1,
        NotApplicable = 2,
    }
}

For backwards compatibility I'd suggest first checking "suppressionstate" and then "suppression"

eberthold commented 4 years ago

Thanks for your detailed answer. I missed to upgrade to the latest SDK packages when I tried to use "suppression". After upgraded the packages it works as expected.

I'll release a fix in the upcoming days.