-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Area-CompilersuntriagedIssues and PRs which have not yet been triaged by a leadIssues and PRs which have not yet been triaged by a lead
Description
The following test fails on net472 with System.FormatException : Input string was not in a correct format..
The problem is with the format string passed to string.Format, where the open brace (first character) isn't escaped: IL_000a: ldstr "{\r\n // Code size ....
[Fact]
public void TODO2()
{
int count = 31;
string op = "shl";
var value = $$"""
{
// Code size 5 (0x5)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldc.i4.s {{count}}
IL_0003: {{op}}
IL_0004: ret
}
""";
}
Message:
System.FormatException : Input string was not in a correct format.
Stack Trace:
StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
String.Format(String format, Object arg0, Object arg1)
NativeIntegerTests.TODO2() line 14939
.method public hidebysig
instance void TODO2 () cil managed
{
.custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = (
01 00 00 00
)
// Method begins at RVA 0x24f4fc
// Code size 29 (0x1d)
.maxstack 3
.locals init (
[0] int32 count,
[1] string op,
[2] string 'value'
)
// {
IL_0000: nop
// int num = 31;
IL_0001: ldc.i4.s 31
IL_0003: stloc.0
// string arg = "shl";
IL_0004: ldstr "shl"
IL_0009: stloc.1
// string text = string.Format("{\r\n // Code size 5 (0x5)\r\n .maxstack 2\r\n IL_0000: ldarg.0\r\n IL_0001: ldc.i4.s {0}\r\n IL_0003: {1}\r\n IL_0004: ret\r\n}", num, arg);
IL_000a: ldstr "{\r\n // Code size 5 (0x5)\r\n .maxstack 2\r\n IL_0000: ldarg.0\r\n IL_0001: ldc.i4.s {0}\r\n IL_0003: {1}\r\n IL_0004: ret\r\n}"
IL_000f: ldloc.0
IL_0010: box [mscorlib]System.Int32
IL_0015: ldloc.1
IL_0016: call string [mscorlib]System.String::Format(string, object, object)
IL_001b: stloc.2
// }
IL_001c: ret
} // end of method NativeIntegerTests::TODO2
Relates to test plan #55306
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-CompilersuntriagedIssues and PRs which have not yet been triaged by a leadIssues and PRs which have not yet been triaged by a lead