Skip to content

IndexOutOfRangeException in RootCommand ctor #2812

@CasualPokePlayer

Description

@CasualPokePlayer

Within my project, an exception ends up thrown in RootCommand's ctor.

System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at System.CommandLine.RootCommand.get_ExecutablePath() + 0x4c
   at System.CommandLine.RootCommand.get_ExecutableName() + 0x24
   at System.CommandLine.RootCommand..ctor(String) + 0x1c
   at GSE.CliArgs.Parse(String[]) + 0x6c
   at GSE.Entrypoint.Main(String[]) + 0x14

This occurs within the Android (or rather linux-bionic) version of this project, compiled under NativeAOT. Looking at the ExecutablePath getter, this seems to be due to Environment.GetCommandLineArgs() returning an empty array (thus indexing it throws).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions