Working with code from Jon Skeet's MiscUtil library, I came across this constructor:
public SmartEnumerable(IEnumerable<T> enumerable)
{
if (enumerable == null)
{
throw new ArgumentNullException ("enumerable");
}
this.enumerable = enumerable;
}
I have both ReSharper and the StyleCop extension installed. I was curious to see what the R# suggestion here would be. It was simplifying the code to the following:
public SmartEnumerable(IEnumerable<T> enumerable)
{
this.enumerable = enumerable ?? throw new ArgumentNullException(nameof(enumerable));
}
StyleCop however has immediately complained with an error message:
A syntax error has been discovered in file SmartEnumerable.cs [StyleCop Rule: SA0102]
I am working on a .NET Standard 1.6 project with VS2017.
StyleCop does not support all of the latest C# language features. This particular behaviour you have found is a known issue.
I'd recommend you switch to StyleCop Analyzers.