Debug writeline with a specific double throws WRONG_TYPE error

Running these two lines of code:

double a = -0.099999999999999978;
Debug.WriteLine($"{a:N2}");

Will throw an exception:

#### Exception System.Exception - CLR_E_WRONG_TYPE (9) ####
#### Message: 
#### System.String::get_Chars [IP: 0000] ####
#### System.Number::InsertGroupSeperators [IP: 0005] ####
#### System.Number::PostProcessFloat [IP: 000c] ####
#### System.Number::Format [IP: 0143] ####
#### System.Double::ToString [IP: 000e] ####
#### System.String::Format [IP: 0260] ####
#### System.String::Format [IP: 0006] ####
#### DigitalSailing.TinyCLR.MainController.Modes.AutoMode::CalculateRear [IP: 001c] ####
#### DigitalSailing.TinyCLR.MainController.Modes.AutoMode::Run [IP: 0014] ####
#### DigitalSailing.TinyCLR.MainController.Modes.ModeGovernor::RunStateEngine [IP: 01b3] ####
Exception thrown: 'System.Exception' in mscorlib.dll
An unhandled exception of type 'System.Exception' occurred in mscorlib.dll

Is there a workaround for this? Since I can’t use Math.round(a,2) either since TinyCLR does not support rounding to an amount of decimals…

I think there is a type-system error in the interpreter. @Darko ran into this around three weeks ago in an equally valid bit of code. There may not be anything you can do here in C#, other than to use a different (and working) formatting string and then massage the result yourself into the format that you want.