ToString("N2") throws exception

Was playing around with the ADC and DAC when encountering a exception throwed by printing a double.ToString(“N2”)

double d = 0;
double dd = 0.01;

while (true)
{
     Debug.WriteLine($"Write -> {d.ToString("N2")}");

     d += dd;
     if (d <= 0 || d >= 1)
         dd *= -1;   //Invert
     Thread.Sleep(100);
}

This is a known issue. Workaround is to cast the double to a float before calling the tostring.