Skip to content

Cosmos: Modernize materializer & subdocument projectionbinding#38550

Open
JoasE wants to merge 283 commits into
dotnet:mainfrom
JoasE:feature/#34567-Materialization
Open

Cosmos: Modernize materializer & subdocument projectionbinding#38550
JoasE wants to merge 283 commits into
dotnet:mainfrom
JoasE:feature/#34567-Materialization

Conversation

@JoasE

@JoasE JoasE commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Part of: #34567
Implements: #34067
Fixes: #38138 , #31696

Copilot AI review requested due to automatic review settings July 8, 2026 11:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 100 out of 104 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • src/EFCore.Cosmos/Properties/CosmosStrings.Designer.cs: Generated file

Comment thread test/EFCore.Tests/Storage/Json/JsonReaderDataTest.cs
Copilot AI review requested due to automatic review settings July 8, 2026 11:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 100 out of 104 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • src/EFCore.Cosmos/Properties/CosmosStrings.Designer.cs: Generated file

Comment thread test/EFCore.Cosmos.FunctionalTests/Query/AdHocJsonQueryCosmosTest.cs Outdated
Copilot AI review requested due to automatic review settings July 8, 2026 13:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 100 out of 104 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • src/EFCore.Cosmos/Properties/CosmosStrings.Designer.cs: Generated file

Comment thread src/EFCore.Cosmos/Extensions/Internal/CosmosResponseStreamHelper.cs
Comment thread src/EFCore.Cosmos/Query/Internal/CosmosProjectionBindingExpressionVisitor.cs Outdated
@JoasE JoasE requested a review from AndriySvyryd July 8, 2026 13:25
@AndriySvyryd

Copy link
Copy Markdown
Member

@AndriySvyryd Thoughts on this?

You can skip these for the Linux emulator for now. But if they say that this is by design we'll have to rethink our approach.

Copilot AI review requested due to automatic review settings July 8, 2026 18:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 100 out of 104 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • src/EFCore.Cosmos/Properties/CosmosStrings.Designer.cs: Generated file

Comment thread src/EFCore.Cosmos/Query/Internal/Expressions/CollectionShaperExpression.cs Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 8, 2026 18:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 100 out of 104 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • src/EFCore.Cosmos/Properties/CosmosStrings.Designer.cs: Generated file
Comments suppressed due to low confidence (1)

src/EFCore/Storage/Json/JsonReaderData.cs:89

  • In stream mode, the leftover-buffer logic uses buffer.Length rather than _bytesAvailable to determine how much valid data remains after totalConsumed. If a stream read returns fewer bytes than the buffer length (common near EOF and possible with non-buffered streams), this will copy uninitialized/stale bytes and overstate _bytesAvailable, corrupting subsequent JSON parsing.


// ReSharper disable once CheckNamespace


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra empty line


// Add undefined and null checks for pk on root document
// This only throws for root document entity types now, see Old_still_works
// @TODO: discuss?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there anything left to discuss here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot! I only wanted to check whether this behavior is correct, which is:
Throw CreateNullKeyValueInNoTracking exception if any primary key value of a root document is null or undefined, not throwing an exception for null key values for owned types and using the ordinal or CLR default value instead.

However, now that I am rubber ducking this, tracking might actually warrant a different exception, and if the owned type isn't one to many (So there is no ordinal), it should probably still throw.

Does that sound right?

writer.WriteStartObject();

foreach (var property in structuralType.GetProperties())
// TODO: Get a better way to order the discriminator property first, without having to special case it here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File an issue for this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created: #38619

@AndriySvyryd AndriySvyryd requested a review from cincuranet July 14, 2026 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cosmos: Materializer rounds when deserializing floating point numbers as fixed point numbers

3 participants