Cysharp / ConsoleAppFramework

Zero Dependency, Zero Overhead, Zero Reflection, Zero Allocation, AOT Safe CLI Framework powered by C# Source Generator.
MIT License
1.66k stars 95 forks source link

Compilation error when string default arguments contain backslashes #138

Closed EX-EXE closed 2 months ago

EX-EXE commented 3 months ago

The default argument's value is converted to a string, causing \ to be reduced to .

public class MyCommands
{
    [Command("Error1")]
    public void Error1(string msg = @"\")
    {
    }
    [Command("Error2")]
    public void Error2(string msg = "\\")
    {
    }
    [Command("Output")]
    public void Output(string msg = @"\\")
    {
        Console.WriteLine(msg); // 「\」
    }
}
neuecc commented 2 months ago

v5.2.4 fixed it, thanks.