tags:

views:

97

answers:

1

The FxCop Globalization Rule, 'Specify IFormat Provider', does not catch Int32.TryParse violations for me. Is this a bug, or am I doing something wrong?

+1  A: 

Quite likely because Int32.TryParse without additional options will refuse to parse strings containing either grouping separators or decimal separators:

Int32.TryParse("1.234", out temp);  // => false
Int32.TryParse("1,234", out temp);  // => false
Int32.TryParse("1234", out temp);   // => true, temp = 1234

So Int32.TryParse is probably not regarded as culture sensitive by FxCop.

Ruben
Thanks, I did not realize thatInt32.TryParse( "0.0", out temp ); //=> false
jyoung