It is definitely related to the code cleanup feature in Visual Studio. After I remove the "Remove unnecessary imports or usings" fixer from my code cleanup profile, the problem is gone. However, I don't want to do that because this fixer is useful in other scenarios. It seems that the code cleanup tool identifies those using statements as unused by mistake after accepting the merge result.
After accepting the merge with Visual Studio 2022 (pro), using statements got deleted. what could be the issue here?
After accepting the merge with Visual Studio 2022 (pro), using statements got deleted.
Developer technologies | Visual Studio | Other
3 answers
Sort by: Most helpful
-
Zitong Yang 10 Reputation points Microsoft Employee
2023-08-31T03:38:32.3933333+00:00 -
Phil Stratford 0 Reputation points
2023-06-13T09:19:17.4466667+00:00 Yep, I'm seeing this too. Pretty disastrous, really. I do a merge from Branch A to Branch B and
using
statements from dozens of files are removed, meaning that the app suddenly won't compile. Seems to leave me with two non-options: Don't do the merge, or manually re-add theusing
statements to every file. -
Phil Stratford 0 Reputation points
2023-10-21T21:12:23.2333333+00:00 Glad it's not just me. This is a horrendous bug/issue. Turned off Code Cleanup for now, based on the answer from @Zitong Yang . I don't know if complaining about it here is going to help - are the Visual Studio devs aware of this issue?