dotnet/roslyn

Autofix option to Generate variable in other class adds unneccesary usings that are implicit

開放

#72,764 建立於 2024年3月27日

 (5 則留言) (0 個反應) (1 位負責人)C# (4,257 個分叉)batch import
Area-IDEBughelp wanted

倉庫指標

星標
 (20,414 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

This issue has been moved from a ticket on Developer Community.


[severity:It's more difficult to complete my work] If I use the option in the below image to generate a variable in another class, in this case it will generate a URI field, it will add a using for System, this is even though we use implicit usings and we do not want that reference. This is leading to a lot of rework on code reviews where unnecessary usings are being picked up and rework and then restarting our whole build process etc. I believe this is the same for a lot of these helper functions where it just adds a using when it may not be required.

If it is too complicated for whatever reason to look up the implicit usings, it would be much better if it didn't try to automatically add the using itself. And if it was required we would at least get a build error and can manually add it.

image.png


Original Comments

Feedback Bot on 3/26/2024, 10:26 PM:

(private comment, text removed)


Original Solutions

(no solutions)

貢獻者指南