From c7035b3ccc485a63bd03a64da4d9f0ec18f27948 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 24 Sep 2024 02:05:15 +0000 Subject: [PATCH 1/3] Update dependencies from https://github.com/dotnet/runtime build 20240923.2 (#34745) [release/9.0] Update dependencies from dotnet/runtime --- eng/Version.Details.xml | 56 ++++++++++++++++++++--------------------- eng/Versions.props | 28 ++++++++++----------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 77953f0b523..8435f2d7f1f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,65 +1,65 @@ - + https://github.com/dotnet/runtime - 9c9e77e8eec007a6cc5e7d14739b14974dbddc55 + 3d9da91a9720f7bda3e4cef127b8195441fb2580 - + https://github.com/dotnet/runtime - 9c9e77e8eec007a6cc5e7d14739b14974dbddc55 + 3d9da91a9720f7bda3e4cef127b8195441fb2580 - + https://github.com/dotnet/runtime - 9c9e77e8eec007a6cc5e7d14739b14974dbddc55 + 3d9da91a9720f7bda3e4cef127b8195441fb2580 - + https://github.com/dotnet/runtime - 9c9e77e8eec007a6cc5e7d14739b14974dbddc55 + 3d9da91a9720f7bda3e4cef127b8195441fb2580 - + https://github.com/dotnet/runtime - 9c9e77e8eec007a6cc5e7d14739b14974dbddc55 + 3d9da91a9720f7bda3e4cef127b8195441fb2580 - + https://github.com/dotnet/runtime - 9c9e77e8eec007a6cc5e7d14739b14974dbddc55 + 3d9da91a9720f7bda3e4cef127b8195441fb2580 - + https://github.com/dotnet/runtime - 9c9e77e8eec007a6cc5e7d14739b14974dbddc55 + 3d9da91a9720f7bda3e4cef127b8195441fb2580 - + https://github.com/dotnet/runtime - 9c9e77e8eec007a6cc5e7d14739b14974dbddc55 + 3d9da91a9720f7bda3e4cef127b8195441fb2580 - + https://github.com/dotnet/runtime - 9c9e77e8eec007a6cc5e7d14739b14974dbddc55 + 3d9da91a9720f7bda3e4cef127b8195441fb2580 - + https://github.com/dotnet/runtime - 9c9e77e8eec007a6cc5e7d14739b14974dbddc55 + 3d9da91a9720f7bda3e4cef127b8195441fb2580 - + https://github.com/dotnet/runtime - 9c9e77e8eec007a6cc5e7d14739b14974dbddc55 + 3d9da91a9720f7bda3e4cef127b8195441fb2580 - + https://github.com/dotnet/runtime - 9c9e77e8eec007a6cc5e7d14739b14974dbddc55 + 3d9da91a9720f7bda3e4cef127b8195441fb2580 - + https://github.com/dotnet/runtime - 9c9e77e8eec007a6cc5e7d14739b14974dbddc55 + 3d9da91a9720f7bda3e4cef127b8195441fb2580 - + https://github.com/dotnet/runtime - 9c9e77e8eec007a6cc5e7d14739b14974dbddc55 + 3d9da91a9720f7bda3e4cef127b8195441fb2580 diff --git a/eng/Versions.props b/eng/Versions.props index baa9c8d29f7..99a39945444 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -17,20 +17,20 @@ False - 9.0.0-rtm.24470.3 - 9.0.0-rtm.24470.3 - 9.0.0-rtm.24470.3 - 9.0.0-rtm.24470.3 - 9.0.0-rtm.24470.3 - 9.0.0-rtm.24470.3 - 9.0.0-rtm.24470.3 - 9.0.0-rtm.24470.3 - 9.0.0-rtm.24470.3 - 9.0.0-rtm.24470.3 - 9.0.0-rtm.24470.3 - 9.0.0-rtm.24470.3 - 9.0.0-rtm.24470.3 - 9.0.0-rtm.24470.3 + 9.0.0-rtm.24473.2 + 9.0.0-rtm.24473.2 + 9.0.0-rtm.24473.2 + 9.0.0-rtm.24473.2 + 9.0.0-rtm.24473.2 + 9.0.0-rtm.24473.2 + 9.0.0-rtm.24473.2 + 9.0.0-rtm.24473.2 + 9.0.0-rtm.24473.2 + 9.0.0-rtm.24473.2 + 9.0.0-rtm.24473.2 + 9.0.0-rtm.24473.2 + 9.0.0-rtm.24473.2 + 9.0.0-rtm.24473.2 9.0.0-beta.24466.2 From 557a697c0dc73ed6fc5ff0a6c44b2f88ecc4731a Mon Sep 17 00:00:00 2001 From: Maurycy Markowski Date: Mon, 23 Sep 2024 22:13:38 -0700 Subject: [PATCH 2/3] Disabling a flaky test - intermittently fails on Linux for InMemory and Sqlite (#34744) --- .../Query/AdHocMiscellaneousQueryTestBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/EFCore.Specification.Tests/Query/AdHocMiscellaneousQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/AdHocMiscellaneousQueryTestBase.cs index fc013607902..220abaad95e 100644 --- a/test/EFCore.Specification.Tests/Query/AdHocMiscellaneousQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/AdHocMiscellaneousQueryTestBase.cs @@ -1381,7 +1381,7 @@ public class Food #region 22841 - [ConditionalFact] + [ConditionalFact(Skip = "Issue #34727 - flaky test")] public virtual async Task SaveChangesAsync_accepts_changes_with_ConfigureAwait_true() { var contextFactory = await InitializeAsync(); From 54ff7e671be3226b4293f5f555942e886e669b88 Mon Sep 17 00:00:00 2001 From: Maurycy Markowski Date: Wed, 25 Sep 2024 00:38:57 -0700 Subject: [PATCH 3/3] Fix to #34728 - Split query with AsNoTrackingWithIdentityResolution() throws ArgumentOutOfRangeException (#34742) (#34743) This is a regression introduced in 9.0 when trying to address a different regression (#33073) Error is caused by a bug in JsonCorrectOrderOfEntitiesForChangeTrackerValidator, specifically it uses the initial SelectExpression to analyze structure of various shaper expressions in the query. Problem is that RelationalSplitCollectionShaperExpression has its own SelectExpression that described the collection - we should use that select expression rather than the parent. Fix is to update SelectExpression used to process the expression when are processing RelationalSplitCollectionShaperExpression Fixes #34728 --- ...sitor.ShaperProcessingExpressionVisitor.cs | 9 +- .../Query/AdHocQuerySplittingQueryTestBase.cs | 100 ++++++++++++++++++ 2 files changed, 106 insertions(+), 3 deletions(-) diff --git a/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.cs b/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.cs index 55741103da4..147b90ffcf7 100644 --- a/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.cs +++ b/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.cs @@ -3055,7 +3055,7 @@ private sealed class JsonCorrectOrderOfEntitiesForChangeTrackerValidator(SelectE { private bool _insideCollection; private bool _insideInclude; - + private SelectExpression _selectExpression = selectExpression; private readonly List<(IEntityType JsonEntityType, List<(IProperty? KeyProperty, int? ConstantKeyValue, int? KeyProjectionIndex)> KeyAccessInfo)> _projectedKeyAccessInfos = []; @@ -3212,8 +3212,11 @@ protected override Expression VisitExtension(Expression extensionExpression) { var insideCollection = _insideCollection; _insideCollection = true; + var oldSelectExpression = _selectExpression; + _selectExpression = splitCollectionShaperExpression.SelectExpression; Visit(splitCollectionShaperExpression.InnerShaper); _insideCollection = insideCollection; + _selectExpression = oldSelectExpression; return splitCollectionShaperExpression; } @@ -3231,7 +3234,7 @@ protected override Expression VisitExtension(Expression extensionExpression) ValueBufferExpression: ProjectionBindingExpression entityProjectionBindingExpression } entityShaperExpression) { - var entityProjection = selectExpression.GetProjection(entityProjectionBindingExpression).GetConstantValue(); + var entityProjection = _selectExpression.GetProjection(entityProjectionBindingExpression).GetConstantValue(); switch (entityProjection) { @@ -3270,7 +3273,7 @@ protected override Expression VisitExtension(Expression extensionExpression) } collectionResultExpression) { var collectionProjection = - selectExpression.GetProjection(collectionProjectionBindingExpression).GetConstantValue(); + _selectExpression.GetProjection(collectionProjectionBindingExpression).GetConstantValue(); switch (collectionProjection) { diff --git a/test/EFCore.Relational.Specification.Tests/Query/AdHocQuerySplittingQueryTestBase.cs b/test/EFCore.Relational.Specification.Tests/Query/AdHocQuerySplittingQueryTestBase.cs index 2b3471ebcb4..94e3b92137e 100644 --- a/test/EFCore.Relational.Specification.Tests/Query/AdHocQuerySplittingQueryTestBase.cs +++ b/test/EFCore.Relational.Specification.Tests/Query/AdHocQuerySplittingQueryTestBase.cs @@ -360,4 +360,104 @@ public Test(int value) } #endregion + + #region 34728 + + [ConditionalTheory] + [InlineData(true)] + [InlineData(false)] + public virtual async Task NoTrackingWithIdentityResolution_split_query_basic(bool async) + { + var contextFactory = await InitializeAsync( + onConfiguring: o => SetQuerySplittingBehavior(o, QuerySplittingBehavior.SplitQuery)); + + using var context = contextFactory.CreateContext(); + var query = context.Set() + .AsNoTrackingWithIdentityResolution() + .Select( + blog => new + { + blog.Id, + Posts = blog.Posts.Select( + blogPost => new + { + blogPost.Id, + blogPost.Author + }).ToList() + }); + + var test = async + ? await query.ToListAsync() + : query.ToList(); + } + + [ConditionalTheory] + [InlineData(true)] + [InlineData(false)] + public virtual async Task NoTrackingWithIdentityResolution_split_query_complex(bool async) + { + var contextFactory = await InitializeAsync( + onConfiguring: o => SetQuerySplittingBehavior(o, QuerySplittingBehavior.SplitQuery)); + + using var context = contextFactory.CreateContext(); + var query = context.Set() + .AsNoTrackingWithIdentityResolution() + .Select( + blog => new + { + blog.Id, + Posts = blog.Posts.Select( + blogPost => new + { + blogPost.Id, + blogPost.Author + }).ToList(), + Posts2 = blog.Posts.Select(x => new + { + x.Id, + Tags = x.Tags.Select(xx => new + { + xx.Id, + xx.Name, + xx.Name.Length + }).ToList() + }).ToList() + }); + + var test = async + ? await query.ToListAsync() + : query.ToList(); + } + + protected class Context34728(DbContextOptions options) : DbContext(options) + { + public DbSet Tests { get; set; } + + public sealed class Blog + { + public long Id { get; set; } + public string Name { get; set; } + public ISet Posts { get; set; } = new HashSet(); + } + + public sealed class BlogPost + { + public long Id { get; set; } + public WebAccount Author { get; set; } + public List Tags { get; set; } + } + + public sealed class WebAccount + { + public long Id { get; set; } + } + + public sealed class Tag + { + public int Id { get; set; } + public string Name { get; set; } + } + } + + #endregion }