Skip to content

Controllers with same name not working #6

@Melchy

Description

@Melchy

Controllers and actions with same name are currently not supported. Folowing example will fail

namespace TestWebApplication.Controllers
{
    [GenerateClient]
    [Route("SameName1")]
    public class ControllersWithSameName
    {
        [HttpGet]
        public int AndWithSameMethod()
        {
            return 1;
        }
    }
}

namespace TestWebApplication.Controllers2
{
    [GenerateClient]
    [Route("SameName2")]
    public class ControllersWithSameName
    {
        [HttpGet]
        public int AndWithSameMethod()
        {
            return 2;
        }
    }
}

With error:
16>CSC: Error CS8785 : Generator 'ControllerClientGenerator' 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 'ControllersWithSameName_Client.g.cs' of the added source file must be unique within a generator. (Parameter 'hintName')'.

Controllers in separate assemblies with same name will compile but routing is incorrect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions