Replies: 2 comments 5 replies
-
Yes. This is an ideal place to use an analyzer |
Beta Was this translation helpful? Give feedback.
4 replies
-
I'll look into writing the analyzer, and could contrib it . THanks for the
feature request.
…On Fri, Nov 13, 2020 at 11:31 AM CyrusNajmabadi ***@***.***> wrote:
I don't see what's wrong with the language of the warning. It seems very
very clear and reasonable to me:
The switch expression does not handle some values of its input type (it is
not exhaustive) involving an unnamed enum value. For example, the pattern
'(Position)3' is not covered.
It's showing how the switch doesn't cover all cases, and it even shows a
specific example of a case that it doesn't match.
I am surprised a custom analyzer would be needed
The language explicitly allows htis code. So we cannot error on code which
is explicitly legal.
I'l add a feature request.
I think you could just write the analyzer yourself :) That's why we have
them. So that it's possible to add these sorts fo features without needing
the language/ide to do it. :)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#49314 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AANSMC6WHSSKVLGADVRQHELSPVUOJANCNFSM4TUWRPPQ>
.
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Version Used:
.Net Framework 4.7.2/C# 8.0
Steps to Reproduce:
enum Position { Right, Left, Top }
Expected Behavior:
No warning is issued with code as shown.
If I add a
Bottom
value to thePosition
enum, a CS8509 warning should be shown.Actual Behavior:
CS8509 (about the switch not being exhaustive) warning is given unless I add a default case.
Comments
When I add
Bottom
to my enum, I want there to be a compile error or warning on the switch statement. If the point of CS8509 is not to provide this safety, is there another warning or way to do this?Beta Was this translation helpful? Give feedback.
All reactions