Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing analyzer warnings in solution explorer with no way to see any details #4893

Closed
loop-evgeny opened this issue Jun 4, 2019 · 17 comments
Labels
Resolution-Fixed The bug has been fixed, refer to the milestone to see in which release it was fixed.
Milestone

Comments

@loop-evgeny
Copy link

Visual Studio Version: 16.1.1

Summary: The Analyzers node in Solution Explorer shows some items that seem to be warnings about the code, but there appears to be no way to see what code they refer to.

Steps to Reproduce:

  1. Create an empty ASP.NET Core 2.2 web application.
  2. Expand Dependencies, Analyzers in solution explorer.

Expected Behavior:

Either no warnings or I can double-click on the warning to go to the line of code where the problem occurs or there is a context menu item for this.

Actual Behavior:

Warnings such as "MVC1000 Use of IHtmlHelper.{0} should be avoided." and "EF1000 Possible SQL injection vulnerability." are shown:

image

There are no warnings in the Error list, even if I build the solution.

In my real project there are also warning icons, like this:

image

This is what first attracted my attention to it and I thought that the warning icons referred to the text of the child nodes, but when I create a new empty project I get those child text nodes without the warning icon. There seem to be other issues about the warning icons, such as #2257 and #4716.

User Impact: Confusion!

@jmarolf jmarolf added the Resolution-By-Design The feature is working as it was designed. label Jun 4, 2019
@jmarolf
Copy link
Contributor

jmarolf commented Jun 4, 2019

@loop-evgeny there is the problem of #2257 where the nodes show a warning icon on the root without explaination, however the issue you point out is by design. These icons (which do not have color) are used to represent the severity of the analyzer result. Documentation is here: https://docs.microsoft.com/en-us/visualstudio/code-quality/use-roslyn-analyzers?view=vs-2019#analyzers-in-solution-explorer

@jmarolf jmarolf closed this as completed Jun 4, 2019
@loop-evgeny
Copy link
Author

OK, so that list of icons just shows the warning defined in the analyzer DLLs and not warnings detected in my solution? Makes sense now, I guess, but with the warning icon it's certainly confusing.

@secretwpn
Copy link

This is a very confusing indication indeed. Hope you find a better way of visualizing this in future.

@drewnoakes
Copy link
Member

@secretwpn we're open to suggestions.

@jez9999
Copy link

jez9999 commented Feb 14, 2020

I agree with the OP, the use of the yellow exclamation mark is profoundly confusing. I associate that with something like "dependency failed to load". If an analyzer loaded fine but generated a code warning, that's not something that should trigger an exclamation mark.

In addition, I have analyzers giving me a bunch of warnings in the solution explorer view (such as "Do not call 'IServiceCollection.BuildServiceProvider' in 'ConfigureServices'"), but none of them appear in the Error List. This really needs to be done better.

@sharwell
Copy link
Member

sharwell commented Feb 14, 2020

@jez9999 The yellow exclamation mark indicates a problem with the project. The gray exclamation is the one that is By Design. One of the images above shows both.

@epvanhouten
Copy link

@sharwell so how do we see the reason for the yellow triangle?

@sharwell
Copy link
Member

sharwell commented Feb 18, 2020

@epvanhouten If I knew the answer to that question, I probably would see many fewer yellow triangles because I would have been able to fix them by now. 😆

@epvanhouten
Copy link

@jmarolf Are we missing something here? How do we get at the information to make the IDE warnings go away?

@jmarolf
Copy link
Contributor

jmarolf commented Feb 18, 2020

@drewnoakes what is the best way to diagnose these?

@drewnoakes
Copy link
Member

In the ideal case, there's a warning in the error list. However often there's not, and they're diagnosed on a case-by-case basis. It's actually currently very difficult to diagnose these due to the design of the dependencies node. We're improving the design, but it will be a while before this is improved very much. In the meantime, if you have a repro that results in such a warning icon, please open an issue and include repro steps.

@jez9999
Copy link

jez9999 commented Feb 26, 2020

I'm still getting quite a few errors in the analyzers which cause a grey icon in the analyzer leaf node, yes, but this then seems to cause parent nodes to get the yellow exclamation mark, with nothing appearing in the error list whatsoever. This seems pretty broken at the moment, UI-wise.

vs-analyzers

@drewnoakes
Copy link
Member

@jez9999 the issue with analyzers has been addressed in the latest 16.5 preview.

There are other cases that trigger the warning icon incorrectly, and we're working to fix them.

@russellg59
Copy link

Jeeeeezuz... these are annoying. Please, please, fix ASAP. To not be able to easily get an explanation is unforgivable in a product that costs $1,000s!

@xiongdashan
Copy link

These are annoying. Please, please, fix ASAP.

@davkean
Copy link
Member

davkean commented Mar 10, 2020

Folks, the warning symbol on the analyzer node with the full path displayed has been fixed in 16.5 Preview. If you continue to see the warning on the analyzer node and you have that version installed, please open a new bug over https://github.com/dotnet/project-system/issues/new.

@davkean davkean added Resolution-Fixed The bug has been fixed, refer to the milestone to see in which release it was fixed. and removed Resolution-By-Design The feature is working as it was designed. labels Mar 10, 2020
@davkean davkean modified the milestones: 16.6, 16.5 Mar 10, 2020
@lukecolbourn
Copy link

I'll miss them when they're gone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution-Fixed The bug has been fixed, refer to the milestone to see in which release it was fixed.
Projects
None yet
Development

No branches or pull requests