Jon Erickson
Jon Erickson

Reputation: 114846

Resharper - How to change 'local variable _ is never used' to be a suggestion

I need to change this to be a suggestion and not a warning, but I cannot find the setting to do so.

Where is it?

This is the code that needs to pass (not a compilier warning). It is saying that transaction is a local variable that is not used, but this is valid.

using (TransactionScope transaction = new TransactionScope())
{
    // ...
}

Upvotes: 1

Views: 406

Answers (3)

crokusek
crokusek

Reputation: 5624

As an answer to the headline of the question (not the specific example).

For (8.2.1):

1) ReSharper -> Options -> Potential Code Quality Issues

2) Enter "Unused Local" in search, a few lines will show up.

The levels can be adjusted on the right.

If I knew how to change that particular color it uses (bad against black background) instead of disabling the warning entirely I would post that also but its having a hard time tracing which element it is (wondering if its even there). Anyone?

Upvotes: 0

Ilya Ryzhenkov
Ilya Ryzhenkov

Reputation: 12142

If you don't need transaction variable, you can replace it with using (new TransactionScope()) { }

Upvotes: 3

Dan Rigby
Dan Rigby

Reputation: 17883

I don't think ReSharper lets you turn things into a suggestion that will result in a compiler warning or error. I believe this is by design.

Upvotes: 1

Related Questions