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
The rule S1168 raises false positive when then nullable annotation is enabled.
Repro steps
public interface IInterface
{
public byte[]? GetNullableFileContent(string itemId);
public byte[] GetFileContent(string itemId);
}
public class Implementation : IInterface
{
public byte[]? GetNullableFileContent(string itemId) => null; // Should not raise because nullable is allowed
public byte[] GetFileContent(string itemId) => null; // Should raise because null is unexpected
}
Expected behavior
Should not raise when nullable is enabled and the syntax is used.
For me there is a big difference between an empty list and a not-existing list. Those are two completely different statements.
On the one hand, not existing means that there is no information about it. On the other hand, an empty list means that, for example, no information has been entered.
For example:
Returning null means "there is no file". Returning an empty array means "there is a file but this file is empty".
I mean rule is very useful when it is required that the value is notnull. When the annotation allows nullable values it is very annoying because the nullables allows the difference between "there is nothing" and "there is something empty".
I think this rule should not be triggered when nullable is enabled and used because the compiler (on newer versions) warns when not checking a nullable value
Actual behavior
Rule will be raised when nullable is enabled and used
The text was updated successfully, but these errors were encountered:
Description
The rule S1168 raises false positive when then nullable annotation is enabled.
Repro steps
Expected behavior
Should not raise when nullable is enabled and the syntax is used.
For me there is a big difference between an empty list and a not-existing list. Those are two completely different statements.
On the one hand, not existing means that there is no information about it. On the other hand, an empty list means that, for example, no information has been entered.
For example:
Returning null means "there is no file". Returning an empty array means "there is a file but this file is empty".
I mean rule is very useful when it is required that the value is notnull. When the annotation allows nullable values it is very annoying because the nullables allows the difference between "there is nothing" and "there is something empty".
I think this rule should not be triggered when nullable is enabled and used because the compiler (on newer versions) warns when not checking a nullable value
Actual behavior
Rule will be raised when nullable is enabled and used
The text was updated successfully, but these errors were encountered: