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

IndexOutOfRangeException when ConsoleAppFilterAttribute is defined above CommandAttribute in ConsoleAppGenerator #134

Closed pierre3 closed 4 months ago

pierre3 commented 4 months ago

When defining ConsoleAppFilterAttribute above CommandAttribute, the following error occurs in the generator:

warning CS8785: Generator 'ConsoleAppGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'IndexOutOfRangeException' with message 'Index was outside the bounds of the array.'
 System.IndexOutOfRangeException: Index was outside the bounds of the array.

Case without problem:

public class MyClass()
{
    [Command("nomunomu")]
    [ConsoleAppFilter<NopFilter>]
    public void Do()
    {
        Console.Write("command");
    }
}

Case that causes an error:

public class MyClass()
{
    [ConsoleAppFilter<NopFilter>]
    [Command("nomunomu")]
    public void Do()
    {
        Console.Write("command");
    }
}
neuecc commented 4 months ago

Fixed in Ver.5.2.2, thanks.