dotnet/roslyn

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

Open

#72,764 opened on 2024年3月27日

GitHub で見る
 (5 comments) (0 reactions) (1 assignee)C# (4,257 forks)batch import
Area-IDEBughelp wanted

Repository metrics

Stars
 (20,414 stars)
PR merge metrics
 (平均マージ 6d 17h) (30d で 256 merged PRs)

説明

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)

コントリビューターガイド