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

Disabled SA1649 code fix for linked files #1714

Closed
wants to merge 1 commit into from

Conversation

vweijsters
Copy link
Contributor

Changed the behavior of the SA1649 code fix to no longer offer a code fix when a document has linked documents. This was done to protect the user from getting unexpected copied or moved source code files.

This prevents #1693 and #1665 from happening. Proper fixing can only be done when dotnet/roslyn#6261 is resolved.

@codecov-io
Copy link

Current coverage is 79.48%

Merging #1714 into master will decrease coverage by -0.01% as of 7d2bb59

@@            master   #1714   diff @@
======================================
  Files          545     545       
  Stmts        32585   32583     -2
  Branches      9005    9006     +1
  Methods                          
======================================
- Hit          25902   25900     -2
- Partial       5232    5234     +2
+ Missed        1451    1449     -2

Review entire Coverage Diff as of 7d2bb59

Powered by Codecov. Updated on successful CI builds.

@sharwell
Copy link
Member

The frustrating thing here is the add/remove document functionality actually does work when you have multiple project files in the same folder. This is a layout that many projects I work on use.

Also, the implementation here is disabling the code fix for files that appear in more than one project, whether or not the file is a linked file or simply included as a normal file in more than one project. The code fix will still behave incorrectly for the following cases:

  • A file is included as a link into only one project in the solution
  • A file is part of a shared project, and that shared project is only referenced by one project in the solution

💭 Perhaps it's better to go with a configuration approach where users can disable a code fix if it's known to be problematic in their solution.

@pdelvo
Copy link
Member

pdelvo commented May 17, 2016

Do we still want this PR?

@vweijsters
Copy link
Contributor Author

I'm still undecided on this, as the issues are still valid. There is no progress on the roslyn issue yet.

It will probably be possible to create a workaround where we use either VisualStudioWorkspace or EnvDTE to make the code fix work properly for Visual Studio only. This will improve the usability for the majority of users, but it will render (part of) the codefix useless outside of Visual Studio.

@sharwell what is your opinion?

@sharwell
Copy link
Member

Such a frustrating case. In some projects, the code fix works wonderfully, while in others it fails completely. 😟

@vweijsters vweijsters closed this Jul 6, 2020
@vweijsters
Copy link
Contributor Author

Its not really relevant anymore

@vweijsters vweijsters deleted the fix-1693 branch July 6, 2020 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants