GetFlagEnumValues is not safe to use
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2.4k
- Forks
- 184
- PR merge metrics
- No merged PRs in 30d
Description
It declares to return `IEnumerable`, so I except it is never null (https://rules.sonarsource.com/csharp/RSPEC-1168).
But `MyEnum.FromValue(0)` returns null.
```
public sealed class MyEnum : SmartFlagEnum
{
public static readonly MyEnum X= new MyEnum(1);
public static readonly MyEnum Y= new MyEnum(2);
private MyEnum (int value, [CallerMemberName] string name = null)
: base(name, value)
{
}
}
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating GetFlagEnumValues and the FromValue(0) path described in the issue. Compare their behavior with the RSPEC-1168 non-null expectation; the issue is done when the reported null result is resolved and the method's IEnumerable contract is upheld.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100