Expand on SingleResult may cause request to never finish
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 505
- Forks
- 186
- PR merge metrics
- No merged PRs in 30d
Description
After upgrading from v7 to v8 I'm running into some issues. One is that some requests simply never return a response. I cannot figure out what is causing this.
I have a basic controller which looks like this:
[EnableQuery]
public IQueryable<SalesOrderLine> Get()
{
return Context.SalesOrderLines;
}
[EnableQuery(MaxExpansionDepth = 3)]
public SingleResult Get(int key)
{
return SingleResult.Create(Context.SalesOrderLines.Where(l => l.SalesOrderLineId == key));
}
The weird thing is when I call the second endpoint without $expand, it returns a response. However, when I include $expand for any expandable property on my SalesOrderLine, the request doesn't finish until it times out. In the logs I only see this:
Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor[1]
Executing ObjectResult, writing value of type 'Microsoft.AspNetCore.OData.Query.Wrapper.SelectAllAndExpand`1[[MyNamespace.SalesOrderLine, MyNamespace, Version=2.23.0.0, Culture=neutral, PublicKeyToken=null]]'.
Strangely, when I call the first endpoint (returning a collection instead of a single result) it works fine, including $expand. Also, I only have this problem on certain controllers, on others $expand works fine on SingleResult. Any thoughts?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the two controller entry points shown: the collection action and the SingleResult action, and reproduce the timeout using $expand on an expandable SalesOrderLine property. Compare their request and response behavior with the logged ObjectResult type; done means the SingleResult endpoint completes successfully with $expand instead of timing out.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100