Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source generator fails when arguments classes are named the same but belong to different namespaces #169

Closed
atifaziz opened this issue Apr 3, 2022 · 0 comments · Fixed by #171
Assignees
Labels
Milestone

Comments

@atifaziz
Copy link
Collaborator

atifaziz commented Apr 3, 2022

If two arguments classes in the same project are named identically but belong in different namespace:

using DocoptNet;

namespace Namespace1
{
    [DocoptArguments]
    sealed partial class ProgramArguments
    {
        const string Help = "Usage: program";
    }
}

namespace Namespace2
{
    [DocoptArguments]
    sealed partial class ProgramArguments
    {
        const string Help = "Usage: program";
    }
}

then build fails with the following error indicating that the source generator failed:

error CS8785: Generator 'SourceGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'ArgumentException' with message 'The hintName 'ProgramArguments.cs' of the added source file must be unique within a generator.
@atifaziz atifaziz added the bug label Apr 3, 2022
@atifaziz atifaziz changed the title Source generator fails when arguments classes are named the same but belonging to different namespaces Source generator fails when arguments classes are named the same but belong to different namespaces Apr 3, 2022
@atifaziz atifaziz linked a pull request Apr 3, 2022 that will close this issue
@atifaziz atifaziz self-assigned this Apr 3, 2022
@atifaziz atifaziz added this to the 0.8.1 milestone Apr 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant