dotnet / project-system

The .NET Project System for Visual Studio
MIT License
969 stars 387 forks source link

Red "ignored" icon next to all analyzers through project reference #8202

Open Sergio0694 opened 2 years ago

Sergio0694 commented 2 years ago

Version Used: VS2022 17.2.0

Steps to Reproduce:

  1. https://github.com/Sergio0694/ComputeSharp
  2. Open solution, build any of the samples (eg. ComputeSharp.Sample)
  3. Expand the analyzers node

Expected Behavior:

The analyzers from local projects should be displayed the same as the other ones.

Actual Behavior:

You should see a red "ignored" icon next to all local analyzers. I assume this come from the git tooling?

image

The icon doesn't really make sense to me though given those generated files are not part of the repository/folder anyway. Also this wasn't there before 17.2.0. Additionally, this doesn't happen when the same analyzer is from a NuGet package.

Neme12 commented 2 years ago

I see this too, even in the Roslyn repo - CSharpSyntaxGenerator works fine but it shows a red icon that says "Ignored" image

jasonmalinowski commented 2 years ago

@drewnoakes Any chance this is fallout with the changes we made around the analyzer nodes? Now that there's a proper file here the Git tooling is triggering?

drewnoakes commented 2 years ago

It seems that way yes. We should investigate whether there's a way of excluding these items from the source control provider's consideration.

jasonmalinowski commented 2 years ago

@drewnoakes Transferred over to project system then; let me know if you need assistance (or need me to look after all).

drewnoakes commented 2 years ago

This falls out from https://github.com/dotnet/project-system/pull/8045 where we added ProjectTreeFlags.FileSystemEntity to these nodes, so that they would report actual file paths to Roslyn, so that Roslyn would be able to correctly identify the analyzer in order to hang child nodes off of it.

It seems that ProjectTreeFlags.FileSystemEntity also enables tracking from the SCC provider.

drewnoakes commented 2 years ago

These red "ignored" source control status icons show because the analyzer assemblies are under the repository's root directory, and potentially subject to source control.

Here's an example from the Imports Tree where a build file is located under the obj folder, where we show the same:

image

We may need a way to suppress source control status for specific tree items. Perhaps via ProjectTreeFlags.

Neme12 commented 2 years ago

I think it's odd that analyzer nodes have the FileSystemEntity flag in the first place. Looking at #8045, it seems that was added as some sort of hack just for the paths to be preserved? Couldn't there be another flag added that does what is necessary to preserve the path, but is separate from FileSystemEntity? That seems like a better solution to this, because the user really doesn't think of the analyzer nodes as files on disk. Even if source control status is suppressed, there might arise other scenarios where certain features are activated for all nodes with FileSystemEntity which isn't appropriate for analyzer nodes.

drewnoakes commented 2 years ago

Yes, that is an option to explore.

drewnoakes commented 2 years ago

With #8329, this issue will also apply to shared projects.

dlandi commented 1 year ago

So this red icon is a ghost we should ignore? What is the status of this issue?

olamission commented 1 year ago

right click - then go to git - then add to source repository image I mean its a plus now beause I solved it

drewnoakes commented 1 year ago

So this red icon is a ghost we should ignore? What is the status of this issue?

Yes you can just ignore it. Obviously we would prefer if it wasn't shown in the first place to avoid confusion. This issue is tracking that.

olamission commented 1 year ago

So this red icon is a ghost we should ignore? What is the status of this issue?

Yes you can just ignore it. Obviously we would prefer if it wasn't shown in the first place to avoid confusion. This issue is tracking that.

If you really want to get rid of it you can right click there should be a git tab then there should be something like add to version control then it would be showing a green plus if you need more info in terms of direction and pictures just respond to me.

drewnoakes commented 1 year ago

If you really want to get rid of it you can right click there should be a git tab then there should be something like add to version control then it would be showing a green plus if you need more info in terms of direction and pictures just respond to me.

You almost certainly don't want to add this file to version control. It's a DLL that's produced during compilation.

In your example above you're referring to a source file. In this specific case it's an analyzer in the dependencies tree, which is quite different.

I've marked our comments here as off topic to hide them and reduce the chance for confusion in this thread.

olamission commented 1 year ago

So this red icon is a ghost we should ignore? What is the status of this issue?

Yes you can just ignore it. Obviously we would prefer if it wasn't shown in the first place to avoid confusion. This issue is tracking that.

Yeah your right . I was just talking about having that problem generally . So for the that package listen to drewnoakes.