I've got a very strange problem. My C# interactive gives me:
> string.Format("{0:P1}", 0, CultureInfo.InvariantCulture)
"0.0%"
However, in the debugger, the same expression yields something else:
> string.Format("{0:P1}", 0, CultureInfo.InvariantCulture)
"0.0 %"
Does anybody have any ideas how this can happen?
Ok, it seems I messed up the order of arguments. I should have
Apparently the compiler and runtime are fine with superfluous format arguments and will happily discard them for you.
The expressions in the OP will have used the Current Culture which may indeed have different semantics between framework and core as @JeroenMostert suggested.