I just enabled FxCop Code Analyzers and, while fixing warnings this one could not be fixed:
CA1062: Validate arguments of public methods
public static string SanitizeFileName(this string fileName)
{
if (fileName is null) throw new ArgumentNullException(nameof(fileName));
foreach (char c in System.IO.Path.GetInvalidFileNameChars())
{
fileName = fileName.Replace(c, '_');
}
return fileName;
}
Compiller still throwing warning CA1062 accessing fileName
Thanks in advance