You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have an enum where one value is equal to another value then when you generate the extensions you get a CS8510 error.
Example Enum:
[EnumExtensions]publicenumGroupLevel{Clear,// Mapped to nullRoot=1,Marketplace=2,Partner=3,Reseller=Partner,Company=4,Customer=Company,BaseProduct=5,Product=6}
Is this not just because of the way you've structure your enum? You have Reseller = Partner, meaning Reseller == 3. By having this, you can never match to reseller because it would have already been matched to Partner first.
Take the example of running GroupLevel.Reseller.ToStringFast() - it would match on Partner and exit.
Hi, sorry for the delay in getting to this. To be honest, I'm not sure the best way to handle it 🤔 It is annoying that it won't even compile...
Maybe the answer is to simply not generate the ToStringFast() method in this case 🤔 The inconsistency is a bit annoying though... Maybe we just can't support this kind of enum
If you have an enum where one value is equal to another value then when you generate the extensions you get a
CS8510
error.Example Enum:
Example of generated code:
Error message: The pattern is unreachable. It has already been handled by a previous arm of the switch expression or it is impossible to match.
The text was updated successfully, but these errors were encountered: