Open
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
After upgrading Microsoft.AspNetCore.OData.Versioning
and Microsoft.AspNetCore.Mvc.Versioning
from 4.1.1 to 5.1.0 and resolving the breaking changes listed here, I found that a couple APIs stopped working.
- Some action APIs are not able to be found (404) even where some actions within the same controller were working. example:
// {ServiceName}/{EntityName}({key})/{action}
[ODataRoute("({key})/" + Constants.ActionName)]
public IActionResult Action([FromODataUri] string key, ODataActionParameters parameters)
- Entity relation parameters tagged with [FromODataUri] are empty for both to a single entity and collection. example:
Expected the passed in guid but found 00000000-0000-0000-0000-000000000000
// {ServiceName}/{EntityName}({key})/Entity/$ref
[HttpPut]
public IActionResult CreateRefToEntity([FromODataUri] Guid key, [FromBody]Uri link)
// {ServiceName}/{EntityName}({key})/Collection/$ref
[HttpPost]
public IActionResult CreateRefToCollection([FromODataUri] Guid key, [FromBody] Uri link)
- There were also some other issues that were resolved by updating the ODataRoute. example:
Adding[ODataRoute({key})]
resolved null value for key
[AcceptVerbs("POST", "PUT")]
public async Task<IActionResult> Put(int key, [FromBody] Customer customer, ODataQueryOptions<Customer> options)
Are these issues expected after upgrading Microsoft.AspNetCore.OData.Versioning
and Microsoft.AspNetCore.Mvc.Versioning
from 4.1.1 to 5.1.0? How do we resolve these errors / debug to find the correct URI?
Expected Behavior
No response
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
6.0.408
Anything else?
ASP.NET Core 6.0
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
commonsensesoftware commentedon Jul 31, 2023
A lot has changed in 2.5 years; OData in particular. Since you are upgrading, is there a particular reason you are staying so far behind on
5.1.0
? The latest version is7.0.x
. With the exception of some significant bugs, no further work will be done or is planned for5.x.x
.There are number of potential causes of the issues you are observing. OData routing behaviors are incredibly inconsistent. Sometimes it only works by convention and other times only with an attribute. I'm not sure I can troubleshoot it from the snippets alone. OData
7.x
vs8.x
is quite different. Do you have the world's simplest repro you can share that would highlight the issues? If I at least have the API versioning setup, EDM setup, and controller/action skeletons, I can probably work backward from there.akristanto commentedon Jul 31, 2023
We tested with version
6.0.0
but it requires ASP.NET Core 8.0 which we do not support yet, so we wanted to upgrade to5.1.0
I will have to get back to you on the repro.
commonsensesoftware commentedon Jul 31, 2023
Point of order.
6.0.0
requires .NET 6.0 and ASP.NET Core 6.0. It does also multi-target to support .NET Core 3.1 due to the slow update of OData, but that has been dropped in7.0
because .NET Core 3.1 is out of support. I try to keep the major version numbers inline with ASP.NET Core itself.7.0
, therefore, aligns to .NET 7.0 and ASP.NET Core 7.0. There is no officially supported version for .NET 8.0 and ASP.NET Core 8.0 - yet.A repro will be great. Thanks.
akristanto commentedon Jul 31, 2023
Sorry, I meant version
6.0.0
requires ASP.NET Core OData 8.0 which we do not support yetcommonsensesoftware commentedon Jul 31, 2023
Ah, gotcha. A great many things were fixed, particularly in routing. If you're stuck on
7.x
for the time being, then so be it. Happy to help iron out getting what you have working on5.1.0
and OData7.x
and/or how to migrate to OData8.x
. 😉commonsensesoftware commentedon Aug 11, 2023
Curious if were able to get repro going? You might be able to use one of the provided OData examples as the baseline. The OpenAPI example probably has the most complex and comprehensive variation of different OData setups.
akristanto commentedon Aug 15, 2023
Sorry, I have not been able to take on this repro yet. This has been put back in priority.
3 remaining items