Added checks for NumberFormatInfo.InvariantInfo everywhere

to resolve problems like #5240.