Skip to content

10.0.0 Preview-2 - KeyedService does not work #1178

@Kumima

Description

@Kumima

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

To reproduce:

builder.Services.AddApiVersioning(
        options =>
        {
            options.ReportApiVersions = true;
            options.ApiVersionReader = new UrlSegmentApiVersionReader();
        })
    .AddApiExplorer(
        options =>
        {
            options.GroupNameFormat = "'v'VV";
            options.SubstitutionFormat = "VV";
            options.SubstituteApiVersionInUrl = true;
        })
    .AddOpenApi();

var app = builder.Build();

app.MapOpenApi().WithDocumentPerVersion();

IVersionedEndpointRouteBuilder versionedApi = app.NewVersionedApi();
RouteGroupBuilder v1Group = versionedApi.MapGroup("v{version:apiVersion}").HasApiVersion(1.0);
// This one throws
v1Group.MapGet(
    "test",
    async Task<ContentHttpResult> (
        [FromKeyedServices("service name")] SomeService someService) =>
    {
         //...
    });

// While this one not
app.MapGet("test2",
  async Task<ContentHttpResult> (
        [FromKeyedServices("service name")] SomeService someService) =>
    {
         //...
    });

See discussion and cause: #1176 (comment)

@commonsensesoftware May I expect a quick fix? Since it totally breaks the usage of KeyedService.

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

No response

Anything else?

No response

Metadata

Metadata

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