Injecting ApiVersion as a parameter in a controller action method. #922
-
I'm currently migrating from Microsoft.AspnetCore.Versioning 5.0.0 to Asp.Versioning 7.0.0-preview.2 In the This is my
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
By not bound, I presume you mean that the action is being reached, but the |
Beta Was this translation helpful? Give feedback.
-
I still think this looks to be a strange setup, but I believe I was able to reproduce your scenario. Some of the core routing setup had to change starting in 6.0. There have been a couple edge case breaking behaviors that I haven't caught, but - in general - it's been for the better. One of these edge cases is a version-neutral controller. It is necessary to have an API version to build out the route tree. Didn't realize there is a scenario where node could be built without all of the discovered endpoints. This leads to incomplete collation and an incomplete set of API versions, which can produce the behavior you're seeing. Version-neutral endpoints have a special mapping to A version-neutral endpoint can accept an API version, which appears to be what you expect. This is supposed to work, but since the collation is incomplete, not all of the versions are present. I have a pending fix and it will go into the final release (as well as I've seen people make mistakes in the past with version-neutral endpoints that accept a perfectly valid, but nonexistent version on a neutral endpoint. It was difficult to detect and track down. While the new behavior might be limiting, it's also more sane and likely what people want. Look for the fix soon. |
Beta Was this translation helpful? Give feedback.
I still think this looks to be a strange setup, but I believe I was able to reproduce your scenario. Some of the core routing setup had to change starting in 6.0. There have been a couple edge case breaking behaviors that I haven't caught, but - in general - it's been for the better.
One of these edge cases is a version-neutral controller. It is necessary to have an API version to build out the route tree. Didn't realize there is a scenario where node could be built without all of the discovered endpoints. This leads to incomplete collation and an incomplete set of API versions, which can produce the behavior you're seeing. Version-neutral endpoints have a special mapping to
ApiVersion.Ne…