Skip to content

Aot support? #897

@bertt

Description

@bertt

Hi, I'm trying to use this library with AOT (PublishAot = true) in .NET 8, but got the following warnings on publish (CommandLineParser 2.9.1):

 Generating native code
CommandLine.dll : warning IL2104: Assembly 'CommandLine' produced trim warnings. For more
 information see https://aka.ms/dotnet-illink/libraries
CommandLine.dll : warning IL3053: Assembly 'CommandLine' produced AOT analysis warnings.

And when running I see:

Unhandled Exception: System.InvalidOperationException: Type Options appears to be immutable, but no constructor found to accept values.

Type options:

public class Options
{
    private readonly bool verbose;

    public Options(bool verbose)
    {
        this.verbose = verbose;
    }
    [Option]
    public bool Verbose { get { return verbose; } }
}

Question: Is publishing with AOT supported?

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