I switched the Value Analysis Mode in Rider to Pessimistic to highlight every "Possible NullReferenceException" and in the example below, I have a warning on the "Languages[0]" part and I don't understand why since I initialize my collection right after declaring it.
It should not be null then.
I just tested on an empty project and I have the same warning.
using System.Collections.Generic;
namespace ClassLibrary1
{
public class Class1
{
public static string Current => Languages[0];
public static readonly List<string> Languages = new List<string>
{
"en"
};
}
}
Is it a mistake made by ReSharper or did I missed something ?
Thanks.