Please provide
- Operating system: Windows 11
- Visual Studio version: Professional 2022 (64-bit) 17.11.5
- SonarLint plugin version: 8.6.0.10679
- Programming language you’re coding in: C#
- Is connected mode used: No
- Connected to SonarCloud or SonarQube (and which version):
And a thorough description of the problem / question:
The following has SonarLint emit a S1144 on the constructor even as it is used in the public static method:
internal readonly record struct ProductId
{
public string Value { get; }
private ProductId(string value) => Value = value;
public static bool TryCreate(string value, [NotNullWhen(true)] out ProductId? result)
{
if (Validate(value))
{
result = new(value);
return true;
}
result = null;
return false;
}
private static bool Validate(string value) { ... }
}