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

GCop140 #6

Closed
PaymonK opened this issue Mar 2, 2018 · 11 comments
Closed

GCop140 #6

PaymonK opened this issue Mar 2, 2018 · 11 comments
Labels
bug Something isn't working
Milestone

Comments

@PaymonK
Copy link
Contributor

PaymonK commented Mar 2, 2018

Rule 140 is giving us false positive.
It should only come into effect if the project is a web application

@PaymonK
Copy link
Contributor Author

PaymonK commented Mar 3, 2018

Actually it should always work and check all projects in the solution.

We need to break the private vs public rules so they can be independently disabled.

For example if a project is meant to be used as a library by projects outside of the current solution it can disable the Public rule.

@mohsad06
Copy link
Contributor

mohsad06 commented Mar 5, 2018

@PaymonK The issue you mentioned is fixed in the latest version.

@PaymonK
Copy link
Contributor Author

PaymonK commented Mar 5, 2018

I'm still getting a lot of false positives.

@Karvan
Copy link
Contributor

Karvan commented Mar 6, 2018

The latest version doesn't show any 140 warnings for the domain projects in our solutions. Probably because there is a reference to the domain, in the website project. which is not correct.

We still need to look into the whole solution, to find if the method or property should be Private, Internal or Public.

@PaymonK PaymonK added bug Something isn't working enhancement labels Mar 7, 2018
@mohsad06
Copy link
Contributor

@Karvan Actually, because .NET Standard doesn't support EnvDTE namespaces yet, and since this rule uses those namespaces, GCop140 won't work in the new GCop packages.

@PaymonK
Copy link
Contributor Author

PaymonK commented Mar 12, 2018

How about .NET Core and .NET Framework separately? We can create multi-platform targeting DLLs if required.

@mohsad06
Copy link
Contributor

@PaymonK I'm not sure about that, currently, Visual Studio only has Analyzer with Code Fix (.NET Standard) project type (which could be deployed as VSIX and NuGet package). Maybe in the future, Microsoft would add support for .NET Core and .NET Framework as well.

@PaymonK
Copy link
Contributor Author

PaymonK commented Mar 12, 2018

Why do we need EnvDTE anyway? What alternative options can we use?

@mohsad06
Copy link
Contributor

@PaymonK Apparently rule 140 uses EnvDTE to look into every project of the given solution and then searches every file and class for the usage of a specific method.
Since .NET Standard is supposed to be cross-platform and EnvDTE isn't, there seems to be no solution at the moment.
I even posted the following question but there are no helpful responses to it yet:
https://stackoverflow.com/questions/48484732/how-to-replace-dte2-in-net-standard
There's another similar question without an actual answer here:
https://stackoverflow.com/questions/46573802/how-can-i-use-envdte-within-a-net-standard-project

@PaymonK
Copy link
Contributor Author

PaymonK commented Mar 12, 2018

I mean other than EnvDTE there must be a way to find all projects and go through them. If you simply want to find all projects in the solution, you can use the file system directly too.

@Karvan Karvan added this to the Release 2.0.0 milestone Mar 21, 2018
@Karvan
Copy link
Contributor

Karvan commented Mar 29, 2018

we followed Roslyn team about this issue and we tried some workaround for having access to Project/Solution level. it's not reliable at all. then we are going to add a VS Extension just for this rule.

for keeping the log:
dotnet/roslyn#25745
dotnet/roslyn#3797 (comment)
dotnet/roslyn#25745 (comment)
dotnet/roslyn#6324

@Karvan Karvan closed this as completed Mar 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants