Skip to content

Cannot use option with explicit interface implementations #591

@pergardebrink

Description

@pergardebrink

Steps to reproduce

Setup interfaces and options like this:

public interface IFoo {
    [Option("foobar")]
    string FooBar { get; set; }
}
public interface IBar {
    [Option("barfoo")]
    string BarFoo { get; set; }
}

public class FooBarOptions : IFoo, IBar {
    IBar.BarFoo { get; set; }
    IFoo.FooBar { get; set; }
}

var result = Parser.Default.ParseArguments<FooBarOptions>(args)

Expected result
The options should be parsed and assigned correctly

Actual result
ArgumentException with message "factory".

The test for if a class ismutable is not seeing the explicitly defined interface properties and/or fields in a class.

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