I am wondering why Code Analysis rule CA1305 - Specify IFormatProvider doesn't work for TryParse methods?
For example with 'Microsoft All Rules' rule set, Code Analysis gives CA1305 warning for following code:
static void Main(string[] args)
{
string text = args[0];
double value = double.Parse(text);
}
but doesn't give CA1305 warning for following code:
static void Main(string[] args)
{
string text = args[0];
double value;
if (!double.TryParse(text, out value))
value = 0;
}
I found this to be very unfortunate because TryParse methods are the correct way to do parsing if input string is not reliable.
Does anyone know if CA1305 rule for TryParse methods is implemented in some newer version of Code Analysis tool or by some 3rd party?