Closed
Description
From nf-interpreter created by MikroBusNet : nanoframework/nf-interpreter#285
The following code will throw a 'System.ArgumentOutOfRangeException' in mscorlib.dll :
private static uint myVar = 0;
public static void Main()
{
Debug.Print("myVar = " + myVar.ToString("N0"));
}
If myVar is 0 and precision is 0 for the 'N' format string, then the FormatNative() method is returning an empty string, which will raise the exception in the InsertGroupSeparators() method (in Number.cs), since original.Length is 0 :
int digitsStartPos = (original[0] == '-') ? 1 : 0;
We can see the same behaviour for all integral types except long and ulong.