roslynator icon indicating copy to clipboard operation
roslynator copied to clipboard

Feature Request: adding checked() to an integral-type cast

Open wiz0u opened this issue 6 years ago • 2 comments
trafficstars

When "Quick Actions" is invoked with the cursor on an integral-type cast, like (uint)value

It would be nice to suggest adding a checked() around the cast-expression checked((uint)value)

But only if the cast is not already enclosed in a checked(), possibly in the larger full expression. For example, it should not be suggested for checked(3 + (uint)value)

wiz0u avatar May 07 '19 14:05 wiz0u

Hmm I think this should be offered as a refactoring rather than an analyzer/codefix. You don't want a warning listed for every integral-type cast in the code.

wiz0u avatar May 14 '19 08:05 wiz0u

You're right.

josefpihrt avatar May 14 '19 11:05 josefpihrt