OData / OData/AspNetCoreOData

oData 8.0.12 with .NET7 reports an error in complex query

Open
#799 16 comments 0 reactions 1 assignee View on GitHub

@xuzhg is already working on this.

Since Jan 10, 2023.

bug followup
Dominant language
C#
Stars
505
Forks
186
PR merge metrics
No merged PRs in 30d

Description

When executing this query:
http://c-logic-api-ef-odata.it.cube.eu/odata/DboTblPAKopf?$top=20&$apply=filter(startswith(concat(cast(paArtNr%2C%27Edm.String%27)%2CpaBez)%2C%275%27))%2Fgroupby((paArtNr%2CpaBez))

I get the following error:

System.InvalidOperationException
Headers are read-only, response has already started.

0 Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpHeaders
0 Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpResponseHeaders
0 Microsoft.AspNetCore.Http.DefaultHttpResponse
80 Cube.CLogic.API_EF_OData.Logging.UnhandledErrorMiddleware+ d__4
82 Cube.CLogic.API_EF_OData.Logging.UnhandledErrorMiddleware+ d__4
37 Cube.CLogic.API_EF_OData.Logging.UnhandledErrorMiddleware+ d__3
0 Microsoft.AspNetCore.Authorization.AuthorizationMiddleware+ d__9
0 Microsoft.AspNetCore.Authentication.AuthenticationMiddleware+ d__6
0 Elastic.Apm.AspNetCore.ApmMiddleware+ d__5

Assemblies affected
"Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.1"
"Microsoft.AspNetCore.OData" Version="8.0.12"
"Microsoft.AspNetCore.OData.NewtonsoftJson" Version="8.0.12"
"Microsoft.OData.Edm" Version="7.12.5"
"Newtonsoft.Json" Version="13.0.2"

Before upgrading it worked without problems, old versions:
"Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.7"
"Microsoft.AspNetCore.OData" Version="8.0.4"
"Microsoft.AspNetCore.OData.NewtonsoftJson" Version="8.0.4"
"Microsoft.OData.Edm" Version="7.9.4"
"Newtonsoft.Json" Version="13.0.2"

Describe the bug
The complex query above leads to an InvalidOperationException "Headers are read-only, response has already started. "

Reproduce steps
executing this query:
http://c-logic-api-ef-odata.it.cube.eu/odata/DboTblPAKopf?$top=20&$apply=filter(startswith(concat(cast(paArtNr%2C%27Edm.String%27)%2CpaBez)%2C%275%27))%2Fgroupby((paArtNr%2CpaBez)

Request/Response
http://c-logic-api-ef-odata.it.cube.eu/odata/DboTblPAKopf?$top=20&$apply=filter(startswith(concat(cast(paArtNr%2C%27Edm.String%27)%2CpaBez)%2C%275%27))%2Fgroupby((paArtNr%2CpaBez)))

Expected behavior
Return valid odata json response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.