Skip to content

CarterModule cannot be declared as internal #380

@vinhdev17

Description

@vinhdev17

Problem
When creating a module using Carter 10.0.0, the class that inherits from ICarterModule must be declared as public.
If I declare it as internal, the Carter framework does not discover or register the module automatically, leading to missing endpoints.

Expected Behavior
ICarterModule should be discoverable even when declared as internal, or the documentation should clearly state that modules must be public.

Actual Behavior

Declaring the module as internal results in no routes being registered.

Changing the module to public fixes the issue.

// This does NOT work — module is not picked up
internal class UserModule : ICarterModule
{
    public void AddRoutes(IEndpointRouteBuilder app) {}
}
// This works
public class UserModule : ICarterModule
{
    public void AddRoutes(IEndpointRouteBuilder app) {}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions