You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Defining the following ApiVersion causes endpoints that use this version to not be accessible (Error 404)
ApiVersion: "2.0-preview" (Major: 2, Minor: 0, status: "preview")
Expected Behavior
Endpoints for the ApiVersion are accessible, and actions can be called on it.
Steps To Reproduce
Create a simple (default) ASP.NET Web Api project and enable Api versioning with URL segments (using the Asp.Versioning.Mvc Nuget package).
Add the following Route attribute on the default controller: [Route("v{version:apiVersion}/[controller]/[action]")]
Add the following ApiVersion attributes on the default controller:
[ApiVersion("1.0")]
[ApiVersion("2.0-alpha")]
[ApiVersion("2.0-preview")]
Run the Api
Try to call a action of version "2.0-alpha" -> Works
Try to call a action of version "2.0-preview" -> Doesn't work (error 404)
Exceptions (if any)
No response
.NET Version
8.0.403
Anything else?
After some early debugging, I came across the following method that seems to cause the issue: Microsoft.AspNetCore.Routing.RoutePatternMatcher.MatchComplexSegmentCore
More specifically the following portion:
Here it seems that the wrong index is calculated for the "v" literal that prefixes the version in the URL in the case of ApiVersion "2.0-preview".
It uses the index of the "v" in the word "preview" instead of the "v" at the start of the URL parameter "v2.0-preview".
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
Describe the bug
Defining the following ApiVersion causes endpoints that use this version to not be accessible (Error 404)
ApiVersion: "2.0-preview" (Major: 2, Minor: 0, status: "preview")
Expected Behavior
Endpoints for the ApiVersion are accessible, and actions can be called on it.
Steps To Reproduce
[Route("v{version:apiVersion}/[controller]/[action]")]
[ApiVersion("1.0")]
[ApiVersion("2.0-alpha")]
[ApiVersion("2.0-preview")]
Exceptions (if any)
No response
.NET Version
8.0.403
Anything else?
After some early debugging, I came across the following method that seems to cause the issue:
Microsoft.AspNetCore.Routing.RoutePatternMatcher.MatchComplexSegmentCore
More specifically the following portion:
Here it seems that the wrong index is calculated for the "v" literal that prefixes the version in the URL in the case of ApiVersion "2.0-preview".
It uses the index of the "v" in the word "preview" instead of the "v" at the start of the URL parameter "v2.0-preview".
The text was updated successfully, but these errors were encountered: