question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fix all occurrences quick action

See original GitHub issue

I 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:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
JohanLarssoncommented, Nov 25, 2019

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.

1reaction
JohanLarssoncommented, Jul 24, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Apply Visual Studio Quick Action on multiple entries
A code fix is available for this rule in Visual Studio. To use it, position the cursor on the string literal and press...
Read more >
Common Quick Actions - Visual Studio (Windows)
Most popular Quick Actions for C# and Visual Basic including fixing misspelled keywords or symbols, resolving merge conflicts, ...
Read more >
C# Quick Actions and Refactorings
To access them, click on the 'light bulb' icon that appears or use the command Quick Fix command Ctrl+. to display a list...
Read more >
Find and Replace Quick Action
The Find and Replace quick action looks through the selected records or all records for any instances of the specified field that contain...
Read more >
General text munging script for use in Quick Action (Service)
I have long used John Gruber's TitleCase.pl script to convert text strings to a proper title case. The way I use it works...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found