Fix all occurrences quick action
See original GitHub issueI recently added this analyzer package to some relatively large code bases, and it has helped me find a handful of bugs. My problem is I also found out this way that there were some types that were being used extensively across the code base that implement IDisposable
, previously unkown to me.
So there are hundreds, if not thousands, of instances of simply creating an instance of this object and using it without disposing it, when it should be disposed.
Thankfully my specific case doesn’t seem to be a critical issue, but I would like to plug this hole ASAP, and having to go through individually has proven prohibitively time consuming.
Being able to apply at least the Add using to end of block
quick action to all of the instances in a file for example would be incredibly helpful.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7
Top GitHub Comments
Enabled it now, will release soon. Made the default fix C# 8 usi8ng declaration. The add using to end of block fix is still there.
I’ll try to find time to add fix all support for the add using to end of scope. Note that ideally a using should be minimal. I added this fix mostly as a convenience when used in tests. Resharper does a nice job at adding using with minimal scope so never implemented that. IIRC they also added add using to Roslyn so there may be built in support that maybe has more fix all options.
There is a minor problem with fixing and releasing. I started rewriting things but got interrupted so master is not in perfect state, should have used a branch. I’ll try to find time to put us back in releasable state.