Author |
Topic |
|
Uniwares
Tomato Guru
Portugal
2322 Posts |
Posted - Mar 23 2022 : 07:27:21 AM
|
For whatever reason, VA thinks that in this if statement are missing case statements. But then gives: "The switch type isn't recognized as an enum."
C#, Win7, VS2017, .NET 4.52 |
|
feline
Whole Tomato Software
United Kingdom
19024 Posts |
Posted - Mar 23 2022 : 11:44:00 AM
|
If you place the caret into "Is", does VA know what to make of this function call? Is something sensible shown in the context and definition fields, and does Alt-G do something sensible?
I don't get why this refactoring would be offered here. Is this command being offered a consistent bug? At least the error message is "reasonable", since the command cannot be run here. |
zen is the art of being at one with the two'ness |
|
|
Uniwares
Tomato Guru
Portugal
2322 Posts |
Posted - Mar 23 2022 : 12:36:35 PM
|
Yes, .Is() is correctly defined and shown as such (extension method on the Enum).
What I just noticed, that this happens anywhere inside a case of a switch (of any other type). Then the option is offered, whatever is under the caret/cursor. Doh. |
|
|
feline
Whole Tomato Software
United Kingdom
19024 Posts |
Posted - Mar 24 2022 : 09:12:55 AM
|
That makes sense. It feels a little unexpected, but when you are inside a case statement it does make sense to offer the option. |
zen is the art of being at one with the two'ness |
|
|
Uniwares
Tomato Guru
Portugal
2322 Posts |
Posted - Mar 24 2022 : 09:51:29 AM
|
Makes sense, although I would not expect it anywhere. Took me by surprise. |
|
|
|
Topic |
|