C# Interpolated String Bug?

Is it a design choice or an oversight that C# is string interpolation is different between the Elements compiler and the Microsoft compiler?

Take this little console app test program:

namespace Test
{
    static class Program
    {
        public static Int32 Main(string[] args)
        {

            string offset = "123";
            string name = "name";
            string index = "index";

            Console.WriteLine(
                $"{offset, 10}" +
                $"{name, 10}" +
                $"{index, 10}"
                );
        }
    }
}

Compiling this in Fire I get three errors but the app still launches:

The output in the console is wrong / different from the output in Visual Studio 2019.

Fire output:

Visual Studio output:

As you can see, the Visual Studio compiler correctly puts the string into columns. See here.

A workaround (not as elegant) is to use String.Format:

Console.WriteLine(String.Format("{0, 10}{1, 10}{2,10}",
       offset, name, index
       ));

It’s not as elegant because you end up having to hardcode the column widths everywhere instead of using a constant.

It looks like we do;'t support the formatting options in interpolated strings. First time I see this TBH, but this is not my area. I’ll log a feature request.

Thanks, logged as bugs://84586

Thanks Marc.

Can Oxygene also benefit from this feature request?

We’ll have to see if this is syntactically unambiguous (I vaguely recall there being concerns), but if so, then we we can probably enable this fort Oxygene as well, yes. maybe I’m confusing this with float formatting options, which IIRC use “:” in C#, and that’d not be valid in Oxygene.