Skip to content

OData.Client 8.2.1 does not materialize data service responses #3124

Open
@dotnetero

Description

@dotnetero

Assemblies affected

  • Microsoft.OData.Client 8.2.1
  • Microsoft.OData.Core 8.2.1
  • Microsoft.OData.Edm 8.2.1
  • Microsoft.Spatial 8.2.1

Other libraries used in the project:

  • Microsoft.EntityFrameworkCore 9.0.0
  • Microsoft.EntityFrameworkCore.Design 9.0.0
  • Microsoft.EntityFrameworkCore.SqlServer 9.0.0
  • Microsoft.EntityFrameworkCore.Tools 9.0.0
  • Microsoft.AspNetCore.OData 9.1.0

Describe the bug

In all requests made by using a unit of work that encapsulates a DataServiceContext, it is not possible to materialize the results, obtaining the same error in all methods "Value cannot be null (Parameter 'key')".

Multiple client applications were programmed on Blazor Server, Wpf Core, among others. These must consume multiple services made with AspNetCore.OData, prior to updating to the assemblies mentioned above, everything worked fine, at this time the calls to the OData services do not materialize.
AspNetCore.OData services work well and return results correctly.

Reproduce steps

  • Create an API with AspNetCore.OData, which consumes data from a database in Sql Server with or without primary keys.
  • Use the OData Connected Service extension to read the metadata and create the class for consumption in client applications.
  • Make a request to the data service, and it should throw the error mentioned above.

Data Model

image

EDM (CSDL) Model

image

Request/Response

Request:
image

Response:
The following image shows that the data service adequately responds to all methods:
image
The response it´s empty on blazor server app or Wpf app.

Expected behavior

Whether the data service returns IQueryable, Enumerable, List, etc. It is expected to be able to materialize these results for consumption in client applications.

Screenshots
image
image
image
image

Additional context

If you use Microsoft.OData.Client 8.1.0, everything works as expected. Leaving client applications with Net 9 and data services with AspNetCore.Odata 9.1.0 and EntityFrameworkCore 9.0.0.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions