From 5ccb348ec1c4e7b16995c673a8d67529dbbe65ca Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sun, 22 Feb 2026 22:29:16 +0000 Subject: [PATCH 1/9] Update dependencies from build 302854 (#37772) [release/10.0] Source code updates from dotnet/dotnet --- NuGet.config | 2 +- eng/Version.Details.props | 10 ++++---- eng/Version.Details.xml | 48 +++++++++++++++++++-------------------- global.json | 4 ++-- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/NuGet.config b/NuGet.config index e5c2e82407f..ba12fe748b0 100644 --- a/NuGet.config +++ b/NuGet.config @@ -4,7 +4,7 @@ - + diff --git a/eng/Version.Details.props b/eng/Version.Details.props index 6d5626f2138..e3cfc932f1b 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -6,9 +6,9 @@ This file should be imported by eng/Versions.props - 10.0.0-beta.26121.102 - 10.0.0-beta.26121.102 - 10.0.0-beta.26121.102 + 10.0.0-beta.26122.102 + 10.0.0-beta.26122.102 + 10.0.0-beta.26122.102 10.0.5 10.0.5 10.0.5 @@ -16,10 +16,10 @@ This file should be imported by eng/Versions.props 10.0.5 10.0.5 10.0.5 - 10.0.5-servicing.26121.102 + 10.0.5-servicing.26122.102 10.0.5 10.0.5 - 10.0.5-servicing.26121.102 + 10.0.5-servicing.26122.102 10.0.5 10.0.5 10.0.5 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c9af5e34fd8..4b47be335ff 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,80 +1,80 @@ - + https://github.com/dotnet/dotnet - 156ff45774adb003ed6fce76aa3ddbbe93b6e3ad + e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 https://github.com/dotnet/dotnet - 156ff45774adb003ed6fce76aa3ddbbe93b6e3ad + e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 https://github.com/dotnet/dotnet - 156ff45774adb003ed6fce76aa3ddbbe93b6e3ad + e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 https://github.com/dotnet/dotnet - 156ff45774adb003ed6fce76aa3ddbbe93b6e3ad + e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 https://github.com/dotnet/dotnet - 156ff45774adb003ed6fce76aa3ddbbe93b6e3ad + e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 https://github.com/dotnet/dotnet - 156ff45774adb003ed6fce76aa3ddbbe93b6e3ad + e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 https://github.com/dotnet/dotnet - 156ff45774adb003ed6fce76aa3ddbbe93b6e3ad + e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 - + https://github.com/dotnet/dotnet - 156ff45774adb003ed6fce76aa3ddbbe93b6e3ad + e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 https://github.com/dotnet/dotnet - 156ff45774adb003ed6fce76aa3ddbbe93b6e3ad + e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 https://github.com/dotnet/dotnet - 156ff45774adb003ed6fce76aa3ddbbe93b6e3ad + e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 - + https://github.com/dotnet/dotnet - 156ff45774adb003ed6fce76aa3ddbbe93b6e3ad + e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 https://github.com/dotnet/dotnet - 156ff45774adb003ed6fce76aa3ddbbe93b6e3ad + e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 https://github.com/dotnet/dotnet - 156ff45774adb003ed6fce76aa3ddbbe93b6e3ad + e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 https://github.com/dotnet/dotnet - 156ff45774adb003ed6fce76aa3ddbbe93b6e3ad + e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 https://github.com/dotnet/dotnet - 156ff45774adb003ed6fce76aa3ddbbe93b6e3ad + e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 - + https://github.com/dotnet/dotnet - 156ff45774adb003ed6fce76aa3ddbbe93b6e3ad + e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 - + https://github.com/dotnet/dotnet - 156ff45774adb003ed6fce76aa3ddbbe93b6e3ad + e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 - + https://github.com/dotnet/dotnet - 156ff45774adb003ed6fce76aa3ddbbe93b6e3ad + e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 diff --git a/global.json b/global.json index 61f004c63b9..06107768d14 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.26121.102", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.26121.102" + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.26122.102", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.26122.102" } } From 45d32675c7d6c306c80742660df39c0fb47db0bc Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 23 Feb 2026 20:43:35 +0000 Subject: [PATCH 2/9] Update dependencies from build 303025 (#37777) [release/10.0] Source code updates from dotnet/dotnet --- NuGet.config | 2 +- eng/Version.Details.props | 10 ++++---- eng/Version.Details.xml | 48 +++++++++++++++++++-------------------- global.json | 4 ++-- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/NuGet.config b/NuGet.config index ba12fe748b0..988085ff156 100644 --- a/NuGet.config +++ b/NuGet.config @@ -4,7 +4,7 @@ - + diff --git a/eng/Version.Details.props b/eng/Version.Details.props index e3cfc932f1b..3e872e74ab1 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -6,9 +6,9 @@ This file should be imported by eng/Versions.props - 10.0.0-beta.26122.102 - 10.0.0-beta.26122.102 - 10.0.0-beta.26122.102 + 10.0.0-beta.26123.105 + 10.0.0-beta.26123.105 + 10.0.0-beta.26123.105 10.0.5 10.0.5 10.0.5 @@ -16,10 +16,10 @@ This file should be imported by eng/Versions.props 10.0.5 10.0.5 10.0.5 - 10.0.5-servicing.26122.102 + 10.0.5-servicing.26123.105 10.0.5 10.0.5 - 10.0.5-servicing.26122.102 + 10.0.5-servicing.26123.105 10.0.5 10.0.5 10.0.5 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4b47be335ff..76a210a4950 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,80 +1,80 @@ - + https://github.com/dotnet/dotnet - e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 + c062731b2949ba96a396c221b3978fcb0a1decd0 https://github.com/dotnet/dotnet - e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 + c062731b2949ba96a396c221b3978fcb0a1decd0 https://github.com/dotnet/dotnet - e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 + c062731b2949ba96a396c221b3978fcb0a1decd0 https://github.com/dotnet/dotnet - e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 + c062731b2949ba96a396c221b3978fcb0a1decd0 https://github.com/dotnet/dotnet - e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 + c062731b2949ba96a396c221b3978fcb0a1decd0 https://github.com/dotnet/dotnet - e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 + c062731b2949ba96a396c221b3978fcb0a1decd0 https://github.com/dotnet/dotnet - e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 + c062731b2949ba96a396c221b3978fcb0a1decd0 - + https://github.com/dotnet/dotnet - e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 + c062731b2949ba96a396c221b3978fcb0a1decd0 https://github.com/dotnet/dotnet - e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 + c062731b2949ba96a396c221b3978fcb0a1decd0 https://github.com/dotnet/dotnet - e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 + c062731b2949ba96a396c221b3978fcb0a1decd0 - + https://github.com/dotnet/dotnet - e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 + c062731b2949ba96a396c221b3978fcb0a1decd0 https://github.com/dotnet/dotnet - e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 + c062731b2949ba96a396c221b3978fcb0a1decd0 https://github.com/dotnet/dotnet - e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 + c062731b2949ba96a396c221b3978fcb0a1decd0 https://github.com/dotnet/dotnet - e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 + c062731b2949ba96a396c221b3978fcb0a1decd0 https://github.com/dotnet/dotnet - e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 + c062731b2949ba96a396c221b3978fcb0a1decd0 - + https://github.com/dotnet/dotnet - e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 + c062731b2949ba96a396c221b3978fcb0a1decd0 - + https://github.com/dotnet/dotnet - e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 + c062731b2949ba96a396c221b3978fcb0a1decd0 - + https://github.com/dotnet/dotnet - e3f0655801bae4b7f1b7b5ceb3a1a60eb748e115 + c062731b2949ba96a396c221b3978fcb0a1decd0 diff --git a/global.json b/global.json index 06107768d14..e58e66fff13 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.26122.102", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.26122.102" + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.26123.105", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.26123.105" } } From f69c3653a04b4ff3ca9da8271125673d07872059 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 24 Feb 2026 10:12:21 +0000 Subject: [PATCH 3/9] Update dependencies from build 303089 (#37782) [release/10.0] Source code updates from dotnet/dotnet --- NuGet.config | 2 +- eng/Version.Details.props | 10 +++--- eng/Version.Details.xml | 48 ++++++++++++------------- eng/common/templates/steps/vmr-sync.yml | 21 ----------- eng/common/templates/vmr-build-pr.yml | 1 + eng/common/tools.ps1 | 5 +++ eng/common/tools.sh | 8 ++++- eng/common/vmr-sync.ps1 | 38 ++++++++++++++++---- eng/common/vmr-sync.sh | 30 +++++++++++++--- global.json | 4 +-- 10 files changed, 102 insertions(+), 65 deletions(-) diff --git a/NuGet.config b/NuGet.config index 988085ff156..46a7bd4cdfe 100644 --- a/NuGet.config +++ b/NuGet.config @@ -4,7 +4,7 @@ - + diff --git a/eng/Version.Details.props b/eng/Version.Details.props index 3e872e74ab1..50b335038b8 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -6,9 +6,9 @@ This file should be imported by eng/Versions.props - 10.0.0-beta.26123.105 - 10.0.0-beta.26123.105 - 10.0.0-beta.26123.105 + 10.0.0-beta.26123.114 + 10.0.0-beta.26123.114 + 10.0.0-beta.26123.114 10.0.5 10.0.5 10.0.5 @@ -16,10 +16,10 @@ This file should be imported by eng/Versions.props 10.0.5 10.0.5 10.0.5 - 10.0.5-servicing.26123.105 + 10.0.5-servicing.26123.114 10.0.5 10.0.5 - 10.0.5-servicing.26123.105 + 10.0.5-servicing.26123.114 10.0.5 10.0.5 10.0.5 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 76a210a4950..09c27daed79 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,80 +1,80 @@ - + https://github.com/dotnet/dotnet - c062731b2949ba96a396c221b3978fcb0a1decd0 + 983bf0e912ce6327d43649b65ea0947372a8a1e7 https://github.com/dotnet/dotnet - c062731b2949ba96a396c221b3978fcb0a1decd0 + 983bf0e912ce6327d43649b65ea0947372a8a1e7 https://github.com/dotnet/dotnet - c062731b2949ba96a396c221b3978fcb0a1decd0 + 983bf0e912ce6327d43649b65ea0947372a8a1e7 https://github.com/dotnet/dotnet - c062731b2949ba96a396c221b3978fcb0a1decd0 + 983bf0e912ce6327d43649b65ea0947372a8a1e7 https://github.com/dotnet/dotnet - c062731b2949ba96a396c221b3978fcb0a1decd0 + 983bf0e912ce6327d43649b65ea0947372a8a1e7 https://github.com/dotnet/dotnet - c062731b2949ba96a396c221b3978fcb0a1decd0 + 983bf0e912ce6327d43649b65ea0947372a8a1e7 https://github.com/dotnet/dotnet - c062731b2949ba96a396c221b3978fcb0a1decd0 + 983bf0e912ce6327d43649b65ea0947372a8a1e7 - + https://github.com/dotnet/dotnet - c062731b2949ba96a396c221b3978fcb0a1decd0 + 983bf0e912ce6327d43649b65ea0947372a8a1e7 https://github.com/dotnet/dotnet - c062731b2949ba96a396c221b3978fcb0a1decd0 + 983bf0e912ce6327d43649b65ea0947372a8a1e7 https://github.com/dotnet/dotnet - c062731b2949ba96a396c221b3978fcb0a1decd0 + 983bf0e912ce6327d43649b65ea0947372a8a1e7 - + https://github.com/dotnet/dotnet - c062731b2949ba96a396c221b3978fcb0a1decd0 + 983bf0e912ce6327d43649b65ea0947372a8a1e7 https://github.com/dotnet/dotnet - c062731b2949ba96a396c221b3978fcb0a1decd0 + 983bf0e912ce6327d43649b65ea0947372a8a1e7 https://github.com/dotnet/dotnet - c062731b2949ba96a396c221b3978fcb0a1decd0 + 983bf0e912ce6327d43649b65ea0947372a8a1e7 https://github.com/dotnet/dotnet - c062731b2949ba96a396c221b3978fcb0a1decd0 + 983bf0e912ce6327d43649b65ea0947372a8a1e7 https://github.com/dotnet/dotnet - c062731b2949ba96a396c221b3978fcb0a1decd0 + 983bf0e912ce6327d43649b65ea0947372a8a1e7 - + https://github.com/dotnet/dotnet - c062731b2949ba96a396c221b3978fcb0a1decd0 + 983bf0e912ce6327d43649b65ea0947372a8a1e7 - + https://github.com/dotnet/dotnet - c062731b2949ba96a396c221b3978fcb0a1decd0 + 983bf0e912ce6327d43649b65ea0947372a8a1e7 - + https://github.com/dotnet/dotnet - c062731b2949ba96a396c221b3978fcb0a1decd0 + 983bf0e912ce6327d43649b65ea0947372a8a1e7 diff --git a/eng/common/templates/steps/vmr-sync.yml b/eng/common/templates/steps/vmr-sync.yml index 599afb6186b..eb619c50268 100644 --- a/eng/common/templates/steps/vmr-sync.yml +++ b/eng/common/templates/steps/vmr-sync.yml @@ -38,27 +38,6 @@ steps: displayName: Label PR commit workingDirectory: $(Agent.BuildDirectory)/repo -- script: | - vmr_sha=$(grep -oP '(?<=Sha=")[^"]*' $(Agent.BuildDirectory)/repo/eng/Version.Details.xml) - echo "##vso[task.setvariable variable=vmr_sha]$vmr_sha" - displayName: Obtain the vmr sha from Version.Details.xml (Unix) - condition: ne(variables['Agent.OS'], 'Windows_NT') - workingDirectory: $(Agent.BuildDirectory)/repo - -- powershell: | - [xml]$xml = Get-Content -Path $(Agent.BuildDirectory)/repo/eng/Version.Details.xml - $vmr_sha = $xml.SelectSingleNode("//Source").Sha - Write-Output "##vso[task.setvariable variable=vmr_sha]$vmr_sha" - displayName: Obtain the vmr sha from Version.Details.xml (Windows) - condition: eq(variables['Agent.OS'], 'Windows_NT') - workingDirectory: $(Agent.BuildDirectory)/repo - -- script: | - git fetch --all - git checkout $(vmr_sha) - displayName: Checkout VMR at correct sha for repo flow - workingDirectory: ${{ parameters.vmrPath }} - - script: | git config --global user.name "dotnet-maestro[bot]" git config --global user.email "dotnet-maestro[bot]@users.noreply.github.com" diff --git a/eng/common/templates/vmr-build-pr.yml b/eng/common/templates/vmr-build-pr.yml index ce3c29a62fa..2f3694fa132 100644 --- a/eng/common/templates/vmr-build-pr.yml +++ b/eng/common/templates/vmr-build-pr.yml @@ -34,6 +34,7 @@ resources: type: github name: dotnet/dotnet endpoint: dotnet + ref: refs/heads/main # Set to whatever VMR branch the PR build should insert into stages: - template: /eng/pipelines/templates/stages/vmr-build.yml@vmr diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 049fe6db994..977a2d4b103 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -824,6 +824,11 @@ function MSBuild-Core() { $cmdArgs = "$($buildTool.Command) /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse /p:ContinuousIntegrationBuild=$ci" + # Add -mt flag for MSBuild multithreaded mode if enabled via environment variable + if ($env:MSBUILD_MT_ENABLED -eq "1") { + $cmdArgs += ' -mt' + } + if ($warnAsError) { $cmdArgs += ' /warnaserror /p:TreatWarningsAsErrors=true' } diff --git a/eng/common/tools.sh b/eng/common/tools.sh index c1841c9dfd0..1b296f646c2 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -526,7 +526,13 @@ function MSBuild-Core { } } - RunBuildTool "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@" + # Add -mt flag for MSBuild multithreaded mode if enabled via environment variable + local mt_switch="" + if [[ "${MSBUILD_MT_ENABLED:-}" == "1" ]]; then + mt_switch="-mt" + fi + + RunBuildTool "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch $mt_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@" } function GetDarc { diff --git a/eng/common/vmr-sync.ps1 b/eng/common/vmr-sync.ps1 index 97302f3205b..b37992d91cf 100755 --- a/eng/common/vmr-sync.ps1 +++ b/eng/common/vmr-sync.ps1 @@ -103,12 +103,20 @@ Set-StrictMode -Version Latest Highlight 'Installing .NET, preparing the tooling..' . .\eng\common\tools.ps1 $dotnetRoot = InitializeDotNetCli -install:$true +$env:DOTNET_ROOT = $dotnetRoot $darc = Get-Darc -$dotnet = "$dotnetRoot\dotnet.exe" Highlight "Starting the synchronization of VMR.." # Synchronize the VMR +$versionDetailsPath = Resolve-Path (Join-Path $PSScriptRoot '..\Version.Details.xml') | Select-Object -ExpandProperty Path +[xml]$versionDetails = Get-Content -Path $versionDetailsPath +$repoName = $versionDetails.SelectSingleNode('//Source').Mapping +if (-not $repoName) { + Fail "Failed to resolve repo mapping from $versionDetailsPath" + exit 1 +} + $darcArgs = ( "vmr", "forwardflow", "--tmp", $tmpDir, @@ -130,9 +138,27 @@ if ($LASTEXITCODE -eq 0) { Highlight "Synchronization succeeded" } else { - Fail "Synchronization of repo to VMR failed!" - Fail "'$vmrDir' is left in its last state (re-run of this script will reset it)." - Fail "Please inspect the logs which contain path to the failing patch file (use -debugOutput to get all the details)." - Fail "Once you make changes to the conflicting VMR patch, commit it locally and re-run this script." - exit 1 + Highlight "Failed to flow code into the local VMR. Falling back to resetting the VMR to match repo contents..." + git -C $vmrDir reset --hard + + $resetArgs = ( + "vmr", "reset", + "${repoName}:HEAD", + "--vmr", $vmrDir, + "--tmp", $tmpDir, + "--additional-remotes", "${repoName}:${repoRoot}" + ) + + & "$darc" $resetArgs + + if ($LASTEXITCODE -eq 0) { + Highlight "Successfully reset the VMR using 'darc vmr reset'" + } + else { + Fail "Synchronization of repo to VMR failed!" + Fail "'$vmrDir' is left in its last state (re-run of this script will reset it)." + Fail "Please inspect the logs which contain path to the failing patch file (use -debugOutput to get all the details)." + Fail "Once you make changes to the conflicting VMR patch, commit it locally and re-run this script." + exit 1 + } } diff --git a/eng/common/vmr-sync.sh b/eng/common/vmr-sync.sh index 44239e331c0..198caec59bd 100755 --- a/eng/common/vmr-sync.sh +++ b/eng/common/vmr-sync.sh @@ -186,6 +186,13 @@ fi # Synchronize the VMR +version_details_path=$(cd "$scriptroot/.."; pwd -P)/Version.Details.xml +repo_name=$(grep -m 1 ' Date: Tue, 24 Feb 2026 12:11:02 +0100 Subject: [PATCH 4/9] Fix projection of entities with complex collections through subqueries (#37747) Fixes #37725 --- .../SqlExpressions/SelectExpression.Helper.cs | 2 +- .../OwnedNavigationsProjectionCosmosTest.cs | 8 ++++++ .../AssociationsProjectionTestBase.cs | 12 +++++++++ .../OwnedNavigationsProjectionTestBase.cs | 4 +++ .../ComplexJsonProjectionSqlServerTest.cs | 17 ++++++++++++ ...exTableSplittingProjectionSqlServerTest.cs | 17 ++++++++++++ .../NavigationsProjectionSqlServerTest.cs | 24 +++++++++++++++++ .../OwnedJsonProjectionSqlServerTest.cs | 20 ++++++++++++++ ...OwnedNavigationsProjectionSqlServerTest.cs | 27 +++++++++++++++++++ ...edTableSplittingProjectionSqlServerTest.cs | 25 +++++++++++++++++ .../ComplexJsonProjectionSqliteTest.cs | 3 +++ ...mplexTableSplittingProjectionSqliteTest.cs | 3 +++ .../NavigationsProjectionSqliteTest.cs | 3 +++ .../OwnedJsonProjectionSqliteTest.cs | 5 ++++ 14 files changed, 169 insertions(+), 1 deletion(-) diff --git a/src/EFCore.Relational/Query/SqlExpressions/SelectExpression.Helper.cs b/src/EFCore.Relational/Query/SqlExpressions/SelectExpression.Helper.cs index 04f2efa9bcc..195e948cec7 100644 --- a/src/EFCore.Relational/Query/SqlExpressions/SelectExpression.Helper.cs +++ b/src/EFCore.Relational/Query/SqlExpressions/SelectExpression.Helper.cs @@ -286,7 +286,7 @@ protected override Expression VisitExtension(Expression expression) var navigation = collectionResultExpression.StructuralProperty switch { INavigationBase n => n, - null => null, + null or IComplexProperty => null, _ => throw new UnreachableException() }; diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionCosmosTest.cs b/test/EFCore.Cosmos.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionCosmosTest.cs index 1ca8de4b054..4902004f2af 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionCosmosTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionCosmosTest.cs @@ -324,6 +324,14 @@ FROM root c #region Subquery + public override async Task Select_subquery_FirstOrDefault_complex_collection(QueryTrackingBehavior queryTrackingBehavior) + { + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + await AssertTranslationFailed(() => base.Select_subquery_FirstOrDefault_complex_collection(queryTrackingBehavior)); + } + } + public override async Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) { if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) diff --git a/test/EFCore.Specification.Tests/Query/Associations/AssociationsProjectionTestBase.cs b/test/EFCore.Specification.Tests/Query/Associations/AssociationsProjectionTestBase.cs index e12923e1a70..3f83d8ff92b 100644 --- a/test/EFCore.Specification.Tests/Query/Associations/AssociationsProjectionTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Associations/AssociationsProjectionTestBase.cs @@ -288,6 +288,18 @@ public virtual Task Select_subquery_optional_related_FirstOrDefault(QueryTrackin .FirstOrDefault()!.RequiredNestedAssociate), queryTrackingBehavior: queryTrackingBehavior); + [ConditionalTheory, MemberData(nameof(TrackingData))] + public virtual Task Select_subquery_FirstOrDefault_complex_collection(QueryTrackingBehavior queryTrackingBehavior) + => AssertQuery( + ss => ss.Set() + .OrderBy(x => x.Id) + .Select(x => ss.Set() + .OrderBy(e => e.Id) + .FirstOrDefault()!.AssociateCollection), + assertOrder: true, + elementAsserter: (e, a) => AssertCollection(e, a, elementSorter: r => r.Id), + queryTrackingBehavior: queryTrackingBehavior); + // [ConditionalTheory] // [MemberData(nameof(TrackingData))] // public virtual Task Select_subquery_root_set_trunk_FirstOrDefault_collection(QueryTrackingBehavior queryTrackingBehavior) diff --git a/test/EFCore.Specification.Tests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionTestBase.cs b/test/EFCore.Specification.Tests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionTestBase.cs index 69d627b3ff7..2fce5fbd6c8 100644 --- a/test/EFCore.Specification.Tests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionTestBase.cs @@ -162,6 +162,10 @@ public override Task SelectMany_nested_collection_on_optional_associate(QueryTra #region Subquery + public override Task Select_subquery_FirstOrDefault_complex_collection(QueryTrackingBehavior queryTrackingBehavior) + => AssertOwnedTrackingQuery( + queryTrackingBehavior, () => base.Select_subquery_FirstOrDefault_complex_collection(queryTrackingBehavior)); + public override Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) => AssertOwnedTrackingQuery( queryTrackingBehavior, () => base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior)); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonProjectionSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonProjectionSqlServerTest.cs index d1f88ea4b84..fbc12a59e64 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonProjectionSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonProjectionSqlServerTest.cs @@ -395,6 +395,23 @@ FROM [RootEntity] AS [r] #region Subquery + public override async Task Select_subquery_FirstOrDefault_complex_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_FirstOrDefault_complex_collection(queryTrackingBehavior); + + AssertSql( + """ +SELECT [r1].[c], [r1].[c0] +FROM [RootEntity] AS [r] +OUTER APPLY ( + SELECT TOP(1) [r0].[AssociateCollection] AS [c], 1 AS [c0] + FROM [RootEntity] AS [r0] + ORDER BY [r0].[Id] +) AS [r1] +ORDER BY [r].[Id] +"""); + } + public override async Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) { await base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingProjectionSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingProjectionSqlServerTest.cs index aaec9222c9e..c224eff9218 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingProjectionSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingProjectionSqlServerTest.cs @@ -253,6 +253,23 @@ FROM [RootEntity] AS [r] #region Subquery + public override async Task Select_subquery_FirstOrDefault_complex_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_FirstOrDefault_complex_collection(queryTrackingBehavior); + + AssertSql( + """ +SELECT [r1].[Id], [r1].[Name], [r1].[OptionalAssociate_Id], [r1].[OptionalAssociate_Int], [r1].[OptionalAssociate_Ints], [r1].[OptionalAssociate_Name], [r1].[OptionalAssociate_String], [r1].[OptionalAssociate_OptionalNestedAssociate_Id], [r1].[OptionalAssociate_OptionalNestedAssociate_Int], [r1].[OptionalAssociate_OptionalNestedAssociate_Ints], [r1].[OptionalAssociate_OptionalNestedAssociate_Name], [r1].[OptionalAssociate_OptionalNestedAssociate_String], [r1].[OptionalAssociate_RequiredNestedAssociate_Id], [r1].[OptionalAssociate_RequiredNestedAssociate_Int], [r1].[OptionalAssociate_RequiredNestedAssociate_Ints], [r1].[OptionalAssociate_RequiredNestedAssociate_Name], [r1].[OptionalAssociate_RequiredNestedAssociate_String], [r1].[RequiredAssociate_Id], [r1].[RequiredAssociate_Int], [r1].[RequiredAssociate_Ints], [r1].[RequiredAssociate_Name], [r1].[RequiredAssociate_String], [r1].[RequiredAssociate_OptionalNestedAssociate_Id], [r1].[RequiredAssociate_OptionalNestedAssociate_Int], [r1].[RequiredAssociate_OptionalNestedAssociate_Ints], [r1].[RequiredAssociate_OptionalNestedAssociate_Name], [r1].[RequiredAssociate_OptionalNestedAssociate_String], [r1].[RequiredAssociate_RequiredNestedAssociate_Id], [r1].[RequiredAssociate_RequiredNestedAssociate_Int], [r1].[RequiredAssociate_RequiredNestedAssociate_Ints], [r1].[RequiredAssociate_RequiredNestedAssociate_Name], [r1].[RequiredAssociate_RequiredNestedAssociate_String], [r1].[c] +FROM [RootEntity] AS [r] +OUTER APPLY ( + SELECT TOP(1) [r0].[Id], [r0].[Name], [r0].[OptionalAssociate_Id], [r0].[OptionalAssociate_Int], [r0].[OptionalAssociate_Ints], [r0].[OptionalAssociate_Name], [r0].[OptionalAssociate_String], [r0].[OptionalAssociate_OptionalNestedAssociate_Id], [r0].[OptionalAssociate_OptionalNestedAssociate_Int], [r0].[OptionalAssociate_OptionalNestedAssociate_Ints], [r0].[OptionalAssociate_OptionalNestedAssociate_Name], [r0].[OptionalAssociate_OptionalNestedAssociate_String], [r0].[OptionalAssociate_RequiredNestedAssociate_Id], [r0].[OptionalAssociate_RequiredNestedAssociate_Int], [r0].[OptionalAssociate_RequiredNestedAssociate_Ints], [r0].[OptionalAssociate_RequiredNestedAssociate_Name], [r0].[OptionalAssociate_RequiredNestedAssociate_String], [r0].[RequiredAssociate_Id], [r0].[RequiredAssociate_Int], [r0].[RequiredAssociate_Ints], [r0].[RequiredAssociate_Name], [r0].[RequiredAssociate_String], [r0].[RequiredAssociate_OptionalNestedAssociate_Id], [r0].[RequiredAssociate_OptionalNestedAssociate_Int], [r0].[RequiredAssociate_OptionalNestedAssociate_Ints], [r0].[RequiredAssociate_OptionalNestedAssociate_Name], [r0].[RequiredAssociate_OptionalNestedAssociate_String], [r0].[RequiredAssociate_RequiredNestedAssociate_Id], [r0].[RequiredAssociate_RequiredNestedAssociate_Int], [r0].[RequiredAssociate_RequiredNestedAssociate_Ints], [r0].[RequiredAssociate_RequiredNestedAssociate_Name], [r0].[RequiredAssociate_RequiredNestedAssociate_String], 1 AS [c] + FROM [RootEntity] AS [r0] + ORDER BY [r0].[Id] +) AS [r1] +ORDER BY [r].[Id] +"""); + } + public override async Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) { await base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionSqlServerTest.cs index 0327eb557c9..1d47e487d71 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionSqlServerTest.cs @@ -353,6 +353,30 @@ FROM [AssociateType] AS [a2] #region Subquery + public override async Task Select_subquery_FirstOrDefault_complex_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_FirstOrDefault_complex_collection(queryTrackingBehavior); + + AssertSql( + """ +SELECT [r].[Id], [r1].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [r1].[c] +FROM [RootEntity] AS [r] +OUTER APPLY ( + SELECT TOP(1) 1 AS [c], [r0].[Id] + FROM [RootEntity] AS [r0] + ORDER BY [r0].[Id] +) AS [r1] +LEFT JOIN ( + SELECT [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n].[Id] AS [Id0], [n0].[Id] AS [Id1], [n1].[Id] AS [Id2], [n1].[CollectionAssociateId], [n1].[Int] AS [Int0], [n1].[Ints] AS [Ints0], [n1].[Name] AS [Name0], [n1].[String] AS [String0], [n].[CollectionAssociateId] AS [CollectionAssociateId0], [n].[Int] AS [Int1], [n].[Ints] AS [Ints1], [n].[Name] AS [Name1], [n].[String] AS [String1], [n0].[CollectionAssociateId] AS [CollectionAssociateId1], [n0].[Int] AS [Int2], [n0].[Ints] AS [Ints2], [n0].[Name] AS [Name2], [n0].[String] AS [String2] + FROM [AssociateType] AS [a] + LEFT JOIN [NestedAssociateType] AS [n] ON [a].[OptionalNestedAssociateId] = [n].[Id] + INNER JOIN [NestedAssociateType] AS [n0] ON [a].[RequiredNestedAssociateId] = [n0].[Id] + LEFT JOIN [NestedAssociateType] AS [n1] ON [a].[Id] = [n1].[CollectionAssociateId] +) AS [s] ON [r1].[Id] = [s].[CollectionRootId] +ORDER BY [r].[Id], [r1].[Id], [s].[Id], [s].[Id0], [s].[Id1] +"""); + } + public override async Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) { await base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonProjectionSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonProjectionSqlServerTest.cs index 0a303e1758f..44e3f0a18e4 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonProjectionSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonProjectionSqlServerTest.cs @@ -437,6 +437,26 @@ FROM [RootEntity] AS [r] #region Subquery + public override async Task Select_subquery_FirstOrDefault_complex_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_FirstOrDefault_complex_collection(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT [r1].[c], [r1].[Id], [r1].[c0] +FROM [RootEntity] AS [r] +OUTER APPLY ( + SELECT TOP(1) [r0].[AssociateCollection] AS [c], [r0].[Id], 1 AS [c0] + FROM [RootEntity] AS [r0] + ORDER BY [r0].[Id] +) AS [r1] +ORDER BY [r].[Id] +"""); + } + } + public override async Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) { await base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionSqlServerTest.cs index 2af3e54335f..17385bbe31a 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionSqlServerTest.cs @@ -395,6 +395,33 @@ FROM [RelatedCollection] AS [r8] #region Subquery + public override async Task Select_subquery_FirstOrDefault_complex_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_FirstOrDefault_complex_collection(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT [r].[Id], [r5].[Id], [s].[RootEntityId], [s].[Id], [s].[Int], [s].[Ints], [s].[Name], [s].[String], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[AssociateTypeRootEntityId0], [s].[AssociateTypeId0], [s].[AssociateTypeRootEntityId1], [s].[AssociateTypeId1], [s].[Id0], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [r5].[c] +FROM [RootEntity] AS [r] +OUTER APPLY ( + SELECT TOP(1) 1 AS [c], [r0].[Id] + FROM [RootEntity] AS [r0] + ORDER BY [r0].[Id] +) AS [r5] +LEFT JOIN ( + SELECT [r1].[RootEntityId], [r1].[Id], [r1].[Int], [r1].[Ints], [r1].[Name], [r1].[String], [r2].[AssociateTypeRootEntityId], [r2].[AssociateTypeId], [r3].[AssociateTypeRootEntityId] AS [AssociateTypeRootEntityId0], [r3].[AssociateTypeId] AS [AssociateTypeId0], [r4].[AssociateTypeRootEntityId] AS [AssociateTypeRootEntityId1], [r4].[AssociateTypeId] AS [AssociateTypeId1], [r4].[Id] AS [Id0], [r4].[Int] AS [Int0], [r4].[Ints] AS [Ints0], [r4].[Name] AS [Name0], [r4].[String] AS [String0], [r2].[Id] AS [Id1], [r2].[Int] AS [Int1], [r2].[Ints] AS [Ints1], [r2].[Name] AS [Name1], [r2].[String] AS [String1], [r3].[Id] AS [Id2], [r3].[Int] AS [Int2], [r3].[Ints] AS [Ints2], [r3].[Name] AS [Name2], [r3].[String] AS [String2] + FROM [RelatedCollection] AS [r1] + LEFT JOIN [RelatedCollection_OptionalNested] AS [r2] ON [r1].[RootEntityId] = [r2].[AssociateTypeRootEntityId] AND [r1].[Id] = [r2].[AssociateTypeId] + LEFT JOIN [RelatedCollection_RequiredNested] AS [r3] ON [r1].[RootEntityId] = [r3].[AssociateTypeRootEntityId] AND [r1].[Id] = [r3].[AssociateTypeId] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r4] ON [r1].[RootEntityId] = [r4].[AssociateTypeRootEntityId] AND [r1].[Id] = [r4].[AssociateTypeId] +) AS [s] ON [r5].[Id] = [s].[RootEntityId] +ORDER BY [r].[Id], [r5].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[AssociateTypeRootEntityId0], [s].[AssociateTypeId0], [s].[AssociateTypeRootEntityId1], [s].[AssociateTypeId1] +"""); + } + } + public override async Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) { await base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingProjectionSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingProjectionSqlServerTest.cs index 9b1bb157768..c6f74a327f1 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingProjectionSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingProjectionSqlServerTest.cs @@ -356,6 +356,31 @@ WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS N #region Subquery + public override async Task Select_subquery_FirstOrDefault_complex_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_FirstOrDefault_complex_collection(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT [r].[Id], [r3].[Id], [s].[RootEntityId], [s].[Id], [s].[Int], [s].[Ints], [s].[Name], [s].[String], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[OptionalNestedAssociate_Id], [s].[OptionalNestedAssociate_Int], [s].[OptionalNestedAssociate_Ints], [s].[OptionalNestedAssociate_Name], [s].[OptionalNestedAssociate_String], [s].[RequiredNestedAssociate_Id], [s].[RequiredNestedAssociate_Int], [s].[RequiredNestedAssociate_Ints], [s].[RequiredNestedAssociate_Name], [s].[RequiredNestedAssociate_String], [r3].[c] +FROM [RootEntity] AS [r] +OUTER APPLY ( + SELECT TOP(1) 1 AS [c], [r0].[Id] + FROM [RootEntity] AS [r0] + ORDER BY [r0].[Id] +) AS [r3] +LEFT JOIN ( + SELECT [r1].[RootEntityId], [r1].[Id], [r1].[Int], [r1].[Ints], [r1].[Name], [r1].[String], [r2].[AssociateTypeRootEntityId], [r2].[AssociateTypeId], [r2].[Id] AS [Id0], [r2].[Int] AS [Int0], [r2].[Ints] AS [Ints0], [r2].[Name] AS [Name0], [r2].[String] AS [String0], [r1].[OptionalNestedAssociate_Id], [r1].[OptionalNestedAssociate_Int], [r1].[OptionalNestedAssociate_Ints], [r1].[OptionalNestedAssociate_Name], [r1].[OptionalNestedAssociate_String], [r1].[RequiredNestedAssociate_Id], [r1].[RequiredNestedAssociate_Int], [r1].[RequiredNestedAssociate_Ints], [r1].[RequiredNestedAssociate_Name], [r1].[RequiredNestedAssociate_String] + FROM [RelatedCollection] AS [r1] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r2] ON [r1].[RootEntityId] = [r2].[AssociateTypeRootEntityId] AND [r1].[Id] = [r2].[AssociateTypeId] +) AS [s] ON [r3].[Id] = [s].[RootEntityId] +ORDER BY [r].[Id], [r3].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId] +"""); + } + } + public override async Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) { await base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior); diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonProjectionSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonProjectionSqliteTest.cs index a342afd4f43..2bc50888559 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonProjectionSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonProjectionSqliteTest.cs @@ -17,6 +17,9 @@ public override Task SelectMany_nested_collection_on_required_associate(QueryTra public override Task SelectMany_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) => AssertApplyNotSupported(() => base.SelectMany_nested_collection_on_optional_associate(queryTrackingBehavior)); + public override Task Select_subquery_FirstOrDefault_complex_collection(QueryTrackingBehavior queryTrackingBehavior) + => AssertApplyNotSupported(() => base.Select_subquery_FirstOrDefault_complex_collection(queryTrackingBehavior)); + public override Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) => AssertApplyNotSupported(() => base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior)); diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingProjectionSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingProjectionSqliteTest.cs index bd2aa117b62..de04e4e6c43 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingProjectionSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingProjectionSqliteTest.cs @@ -8,6 +8,9 @@ namespace Microsoft.EntityFrameworkCore.Query.Associations.ComplexTableSplitting public class ComplexTableSplittingProjectionSqliteTest(ComplexTableSplittingSqliteFixture fixture, ITestOutputHelper testOutputHelper) : ComplexTableSplittingProjectionRelationalTestBase(fixture, testOutputHelper) { + public override Task Select_subquery_FirstOrDefault_complex_collection(QueryTrackingBehavior queryTrackingBehavior) + => AssertApplyNotSupported(() => base.Select_subquery_FirstOrDefault_complex_collection(queryTrackingBehavior)); + public override Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) => AssertApplyNotSupported(() => base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior)); diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionSqliteTest.cs index 287c5f590ed..d5e87a09320 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionSqliteTest.cs @@ -8,6 +8,9 @@ namespace Microsoft.EntityFrameworkCore.Query.Associations.Navigations; public class NavigationsProjectionSqliteTest(NavigationsSqliteFixture fixture, ITestOutputHelper testOutputHelper) : NavigationsProjectionRelationalTestBase(fixture, testOutputHelper) { + public override Task Select_subquery_FirstOrDefault_complex_collection(QueryTrackingBehavior queryTrackingBehavior) + => AssertApplyNotSupported(() => base.Select_subquery_FirstOrDefault_complex_collection(queryTrackingBehavior)); + public override Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) => AssertApplyNotSupported(() => base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior)); diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonProjectionSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonProjectionSqliteTest.cs index a09bb692310..0a534560a9a 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonProjectionSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonProjectionSqliteTest.cs @@ -23,6 +23,11 @@ public override Task SelectMany_nested_collection_on_optional_associate(QueryTra ? Task.CompletedTask // Base test expects "can't track owned entities" exception, but with SQLite we get "no CROSS APPLY" : AssertApplyNotSupported(() => base.SelectMany_nested_collection_on_optional_associate(queryTrackingBehavior)); + public override Task Select_subquery_FirstOrDefault_complex_collection(QueryTrackingBehavior queryTrackingBehavior) + => queryTrackingBehavior is QueryTrackingBehavior.TrackAll + ? Task.CompletedTask // Base test expects "can't track owned entities" exception, but with SQLite we get "no CROSS APPLY" + : AssertApplyNotSupported(() => base.Select_subquery_FirstOrDefault_complex_collection(queryTrackingBehavior)); + public override Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) => queryTrackingBehavior is QueryTrackingBehavior.TrackAll ? Task.CompletedTask // Base test expects "can't track owned entities" exception, but with SQLite we get "no CROSS APPLY" From 1460789aae6faac334fb69dd0f7d883b508bfd01 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 24 Feb 2026 11:20:47 +0000 Subject: [PATCH 5/9] Update dependencies from build 303150 (#37789) [release/10.0] Source code updates from dotnet/dotnet --- NuGet.config | 2 +- eng/Version.Details.props | 10 ++++---- eng/Version.Details.xml | 48 +++++++++++++++++++-------------------- global.json | 4 ++-- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/NuGet.config b/NuGet.config index 46a7bd4cdfe..67de22d38c8 100644 --- a/NuGet.config +++ b/NuGet.config @@ -4,7 +4,7 @@ - + diff --git a/eng/Version.Details.props b/eng/Version.Details.props index 50b335038b8..2ca30e1afb5 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -6,9 +6,9 @@ This file should be imported by eng/Versions.props - 10.0.0-beta.26123.114 - 10.0.0-beta.26123.114 - 10.0.0-beta.26123.114 + 10.0.0-beta.26123.124 + 10.0.0-beta.26123.124 + 10.0.0-beta.26123.124 10.0.5 10.0.5 10.0.5 @@ -16,10 +16,10 @@ This file should be imported by eng/Versions.props 10.0.5 10.0.5 10.0.5 - 10.0.5-servicing.26123.114 + 10.0.5-servicing.26123.124 10.0.5 10.0.5 - 10.0.5-servicing.26123.114 + 10.0.5-servicing.26123.124 10.0.5 10.0.5 10.0.5 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 09c27daed79..3f7d9ba2f21 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,80 +1,80 @@ - + https://github.com/dotnet/dotnet - 983bf0e912ce6327d43649b65ea0947372a8a1e7 + f8e4f7d30c6813e5fb21e641f1b323fb67921108 https://github.com/dotnet/dotnet - 983bf0e912ce6327d43649b65ea0947372a8a1e7 + f8e4f7d30c6813e5fb21e641f1b323fb67921108 https://github.com/dotnet/dotnet - 983bf0e912ce6327d43649b65ea0947372a8a1e7 + f8e4f7d30c6813e5fb21e641f1b323fb67921108 https://github.com/dotnet/dotnet - 983bf0e912ce6327d43649b65ea0947372a8a1e7 + f8e4f7d30c6813e5fb21e641f1b323fb67921108 https://github.com/dotnet/dotnet - 983bf0e912ce6327d43649b65ea0947372a8a1e7 + f8e4f7d30c6813e5fb21e641f1b323fb67921108 https://github.com/dotnet/dotnet - 983bf0e912ce6327d43649b65ea0947372a8a1e7 + f8e4f7d30c6813e5fb21e641f1b323fb67921108 https://github.com/dotnet/dotnet - 983bf0e912ce6327d43649b65ea0947372a8a1e7 + f8e4f7d30c6813e5fb21e641f1b323fb67921108 - + https://github.com/dotnet/dotnet - 983bf0e912ce6327d43649b65ea0947372a8a1e7 + f8e4f7d30c6813e5fb21e641f1b323fb67921108 https://github.com/dotnet/dotnet - 983bf0e912ce6327d43649b65ea0947372a8a1e7 + f8e4f7d30c6813e5fb21e641f1b323fb67921108 https://github.com/dotnet/dotnet - 983bf0e912ce6327d43649b65ea0947372a8a1e7 + f8e4f7d30c6813e5fb21e641f1b323fb67921108 - + https://github.com/dotnet/dotnet - 983bf0e912ce6327d43649b65ea0947372a8a1e7 + f8e4f7d30c6813e5fb21e641f1b323fb67921108 https://github.com/dotnet/dotnet - 983bf0e912ce6327d43649b65ea0947372a8a1e7 + f8e4f7d30c6813e5fb21e641f1b323fb67921108 https://github.com/dotnet/dotnet - 983bf0e912ce6327d43649b65ea0947372a8a1e7 + f8e4f7d30c6813e5fb21e641f1b323fb67921108 https://github.com/dotnet/dotnet - 983bf0e912ce6327d43649b65ea0947372a8a1e7 + f8e4f7d30c6813e5fb21e641f1b323fb67921108 https://github.com/dotnet/dotnet - 983bf0e912ce6327d43649b65ea0947372a8a1e7 + f8e4f7d30c6813e5fb21e641f1b323fb67921108 - + https://github.com/dotnet/dotnet - 983bf0e912ce6327d43649b65ea0947372a8a1e7 + f8e4f7d30c6813e5fb21e641f1b323fb67921108 - + https://github.com/dotnet/dotnet - 983bf0e912ce6327d43649b65ea0947372a8a1e7 + f8e4f7d30c6813e5fb21e641f1b323fb67921108 - + https://github.com/dotnet/dotnet - 983bf0e912ce6327d43649b65ea0947372a8a1e7 + f8e4f7d30c6813e5fb21e641f1b323fb67921108 diff --git a/global.json b/global.json index ded8dcfe28d..625d406f289 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.26123.114", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.26123.114" + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.26123.124", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.26123.124" } } From 1d6294e74eeccf25951b6b4f718c18e3af229209 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 25 Feb 2026 01:09:13 +0000 Subject: [PATCH 6/9] Update dependencies from build 303190 (#37793) [release/10.0] Source code updates from dotnet/dotnet --- NuGet.config | 2 +- eng/Version.Details.props | 10 ++++---- eng/Version.Details.xml | 48 +++++++++++++++++++-------------------- global.json | 4 ++-- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/NuGet.config b/NuGet.config index 67de22d38c8..b039beda539 100644 --- a/NuGet.config +++ b/NuGet.config @@ -4,7 +4,7 @@ - + diff --git a/eng/Version.Details.props b/eng/Version.Details.props index 2ca30e1afb5..f2c8566dccb 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -6,9 +6,9 @@ This file should be imported by eng/Versions.props - 10.0.0-beta.26123.124 - 10.0.0-beta.26123.124 - 10.0.0-beta.26123.124 + 10.0.0-beta.26124.105 + 10.0.0-beta.26124.105 + 10.0.0-beta.26124.105 10.0.5 10.0.5 10.0.5 @@ -16,10 +16,10 @@ This file should be imported by eng/Versions.props 10.0.5 10.0.5 10.0.5 - 10.0.5-servicing.26123.124 + 10.0.5-servicing.26124.105 10.0.5 10.0.5 - 10.0.5-servicing.26123.124 + 10.0.5-servicing.26124.105 10.0.5 10.0.5 10.0.5 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3f7d9ba2f21..235a26fe045 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,80 +1,80 @@ - + https://github.com/dotnet/dotnet - f8e4f7d30c6813e5fb21e641f1b323fb67921108 + 67923c99548f3688ff9c01a9458f5dab3b0f9b57 https://github.com/dotnet/dotnet - f8e4f7d30c6813e5fb21e641f1b323fb67921108 + 67923c99548f3688ff9c01a9458f5dab3b0f9b57 https://github.com/dotnet/dotnet - f8e4f7d30c6813e5fb21e641f1b323fb67921108 + 67923c99548f3688ff9c01a9458f5dab3b0f9b57 https://github.com/dotnet/dotnet - f8e4f7d30c6813e5fb21e641f1b323fb67921108 + 67923c99548f3688ff9c01a9458f5dab3b0f9b57 https://github.com/dotnet/dotnet - f8e4f7d30c6813e5fb21e641f1b323fb67921108 + 67923c99548f3688ff9c01a9458f5dab3b0f9b57 https://github.com/dotnet/dotnet - f8e4f7d30c6813e5fb21e641f1b323fb67921108 + 67923c99548f3688ff9c01a9458f5dab3b0f9b57 https://github.com/dotnet/dotnet - f8e4f7d30c6813e5fb21e641f1b323fb67921108 + 67923c99548f3688ff9c01a9458f5dab3b0f9b57 - + https://github.com/dotnet/dotnet - f8e4f7d30c6813e5fb21e641f1b323fb67921108 + 67923c99548f3688ff9c01a9458f5dab3b0f9b57 https://github.com/dotnet/dotnet - f8e4f7d30c6813e5fb21e641f1b323fb67921108 + 67923c99548f3688ff9c01a9458f5dab3b0f9b57 https://github.com/dotnet/dotnet - f8e4f7d30c6813e5fb21e641f1b323fb67921108 + 67923c99548f3688ff9c01a9458f5dab3b0f9b57 - + https://github.com/dotnet/dotnet - f8e4f7d30c6813e5fb21e641f1b323fb67921108 + 67923c99548f3688ff9c01a9458f5dab3b0f9b57 https://github.com/dotnet/dotnet - f8e4f7d30c6813e5fb21e641f1b323fb67921108 + 67923c99548f3688ff9c01a9458f5dab3b0f9b57 https://github.com/dotnet/dotnet - f8e4f7d30c6813e5fb21e641f1b323fb67921108 + 67923c99548f3688ff9c01a9458f5dab3b0f9b57 https://github.com/dotnet/dotnet - f8e4f7d30c6813e5fb21e641f1b323fb67921108 + 67923c99548f3688ff9c01a9458f5dab3b0f9b57 https://github.com/dotnet/dotnet - f8e4f7d30c6813e5fb21e641f1b323fb67921108 + 67923c99548f3688ff9c01a9458f5dab3b0f9b57 - + https://github.com/dotnet/dotnet - f8e4f7d30c6813e5fb21e641f1b323fb67921108 + 67923c99548f3688ff9c01a9458f5dab3b0f9b57 - + https://github.com/dotnet/dotnet - f8e4f7d30c6813e5fb21e641f1b323fb67921108 + 67923c99548f3688ff9c01a9458f5dab3b0f9b57 - + https://github.com/dotnet/dotnet - f8e4f7d30c6813e5fb21e641f1b323fb67921108 + 67923c99548f3688ff9c01a9458f5dab3b0f9b57 diff --git a/global.json b/global.json index 625d406f289..dcf1cfc3ea1 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.26123.124", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.26123.124" + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.26124.105", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.26124.105" } } From 0cc9a4b1bc78b38933d93eb39c41fd0e41df2c2c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 25 Feb 2026 09:07:47 +0000 Subject: [PATCH 7/9] Update dependencies from build 303263 (#37801) [release/10.0] Source code updates from dotnet/dotnet --- NuGet.config | 2 +- eng/Version.Details.props | 10 ++++---- eng/Version.Details.xml | 48 +++++++++++++++++++-------------------- global.json | 4 ++-- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/NuGet.config b/NuGet.config index b039beda539..500f8333385 100644 --- a/NuGet.config +++ b/NuGet.config @@ -4,7 +4,7 @@ - + diff --git a/eng/Version.Details.props b/eng/Version.Details.props index f2c8566dccb..c99a63a265a 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -6,9 +6,9 @@ This file should be imported by eng/Versions.props - 10.0.0-beta.26124.105 - 10.0.0-beta.26124.105 - 10.0.0-beta.26124.105 + 10.0.0-beta.26124.113 + 10.0.0-beta.26124.113 + 10.0.0-beta.26124.113 10.0.5 10.0.5 10.0.5 @@ -16,10 +16,10 @@ This file should be imported by eng/Versions.props 10.0.5 10.0.5 10.0.5 - 10.0.5-servicing.26124.105 + 10.0.5-servicing.26124.113 10.0.5 10.0.5 - 10.0.5-servicing.26124.105 + 10.0.5-servicing.26124.113 10.0.5 10.0.5 10.0.5 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 235a26fe045..ab85d2406dc 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,80 +1,80 @@ - + https://github.com/dotnet/dotnet - 67923c99548f3688ff9c01a9458f5dab3b0f9b57 + 4f2d31c20fb1dea7a279c108c4fb2bf02824afee https://github.com/dotnet/dotnet - 67923c99548f3688ff9c01a9458f5dab3b0f9b57 + 4f2d31c20fb1dea7a279c108c4fb2bf02824afee https://github.com/dotnet/dotnet - 67923c99548f3688ff9c01a9458f5dab3b0f9b57 + 4f2d31c20fb1dea7a279c108c4fb2bf02824afee https://github.com/dotnet/dotnet - 67923c99548f3688ff9c01a9458f5dab3b0f9b57 + 4f2d31c20fb1dea7a279c108c4fb2bf02824afee https://github.com/dotnet/dotnet - 67923c99548f3688ff9c01a9458f5dab3b0f9b57 + 4f2d31c20fb1dea7a279c108c4fb2bf02824afee https://github.com/dotnet/dotnet - 67923c99548f3688ff9c01a9458f5dab3b0f9b57 + 4f2d31c20fb1dea7a279c108c4fb2bf02824afee https://github.com/dotnet/dotnet - 67923c99548f3688ff9c01a9458f5dab3b0f9b57 + 4f2d31c20fb1dea7a279c108c4fb2bf02824afee - + https://github.com/dotnet/dotnet - 67923c99548f3688ff9c01a9458f5dab3b0f9b57 + 4f2d31c20fb1dea7a279c108c4fb2bf02824afee https://github.com/dotnet/dotnet - 67923c99548f3688ff9c01a9458f5dab3b0f9b57 + 4f2d31c20fb1dea7a279c108c4fb2bf02824afee https://github.com/dotnet/dotnet - 67923c99548f3688ff9c01a9458f5dab3b0f9b57 + 4f2d31c20fb1dea7a279c108c4fb2bf02824afee - + https://github.com/dotnet/dotnet - 67923c99548f3688ff9c01a9458f5dab3b0f9b57 + 4f2d31c20fb1dea7a279c108c4fb2bf02824afee https://github.com/dotnet/dotnet - 67923c99548f3688ff9c01a9458f5dab3b0f9b57 + 4f2d31c20fb1dea7a279c108c4fb2bf02824afee https://github.com/dotnet/dotnet - 67923c99548f3688ff9c01a9458f5dab3b0f9b57 + 4f2d31c20fb1dea7a279c108c4fb2bf02824afee https://github.com/dotnet/dotnet - 67923c99548f3688ff9c01a9458f5dab3b0f9b57 + 4f2d31c20fb1dea7a279c108c4fb2bf02824afee https://github.com/dotnet/dotnet - 67923c99548f3688ff9c01a9458f5dab3b0f9b57 + 4f2d31c20fb1dea7a279c108c4fb2bf02824afee - + https://github.com/dotnet/dotnet - 67923c99548f3688ff9c01a9458f5dab3b0f9b57 + 4f2d31c20fb1dea7a279c108c4fb2bf02824afee - + https://github.com/dotnet/dotnet - 67923c99548f3688ff9c01a9458f5dab3b0f9b57 + 4f2d31c20fb1dea7a279c108c4fb2bf02824afee - + https://github.com/dotnet/dotnet - 67923c99548f3688ff9c01a9458f5dab3b0f9b57 + 4f2d31c20fb1dea7a279c108c4fb2bf02824afee diff --git a/global.json b/global.json index dcf1cfc3ea1..0048e3e15e9 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.26124.105", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.26124.105" + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.26124.113", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.26124.113" } } From aa10d1dad819ef7bc16d7b3c40757a4eec7ddbca Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Feb 2026 16:48:41 -0800 Subject: [PATCH 8/9] [release/10.0] Fix InvalidCastException in OriginalValues.ToObject() with nested nullable complex properties (#37703) Fixes #37516 Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com> --- .../Internal/ArrayPropertyValues.cs | 64 ++- .../Internal/PropertyValuesTest.cs | 405 ++++++++++++++++-- 2 files changed, 433 insertions(+), 36 deletions(-) diff --git a/src/EFCore/ChangeTracking/Internal/ArrayPropertyValues.cs b/src/EFCore/ChangeTracking/Internal/ArrayPropertyValues.cs index 5b7a3e651f8..49eb9ccf7dd 100644 --- a/src/EFCore/ChangeTracking/Internal/ArrayPropertyValues.cs +++ b/src/EFCore/ChangeTracking/Internal/ArrayPropertyValues.cs @@ -18,6 +18,9 @@ public class ArrayPropertyValues : PropertyValues private readonly List?[] _complexCollectionValues; private readonly bool[]? _nullComplexPropertyFlags; + private static readonly bool UseOldBehavior37516 = + AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue37516", out var enabled) && enabled; + /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in @@ -50,7 +53,7 @@ public override object ToObject() if (_nullComplexPropertyFlags[i]) { var complexProperty = NullableComplexProperties[i]; - structuralObject = ((IRuntimeComplexProperty)complexProperty).GetSetter().SetClrValue(structuralObject, null); + structuralObject = SetNestedComplexPropertyValue(structuralObject, complexProperty, null); } } } @@ -68,7 +71,7 @@ public override object ToObject() !complexProperty.IsShadowProperty(), $"Shadow complex property {complexProperty.Name} is not supported. Issue #31243"); var list = (IList)((IRuntimeComplexProperty)complexProperty).GetIndexedCollectionAccessor().Create(propertyValuesList.Count); - structuralObject = ((IRuntimeComplexProperty)complexProperty).GetSetter().SetClrValue(structuralObject, list); + structuralObject = SetNestedComplexPropertyValue(structuralObject, complexProperty, list); foreach (var propertyValues in propertyValuesList) { @@ -79,6 +82,33 @@ public override object ToObject() return structuralObject; } + private object SetNestedComplexPropertyValue(object structuralObject, IComplexProperty complexProperty, object? value) + { + return UseOldBehavior37516 + ? ((IRuntimeComplexProperty)complexProperty).GetSetter().SetClrValue(structuralObject, value) + : SetValueRecursively(structuralObject, complexProperty.GetChainToComplexProperty(fromEntity: false), 0, value); + + static object SetValueRecursively(object instance, IReadOnlyList chain, int index, object? value) + { + var currentProperty = (IRuntimeComplexProperty)chain[index]; + if (index == chain.Count - 1) + { + return currentProperty.GetSetter().SetClrValue(instance, value); + } + + var child = currentProperty.GetGetter().GetClrValue(instance); + if (child is null) + { + return instance; + } + + var updated = SetValueRecursively(child, chain, index + 1, value); + // Need to update the child value as well because it could be a value type + // TODO: Improve this, see #36041 + return currentProperty.GetSetter().SetClrValue(instance, updated); + } + } + /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in @@ -495,20 +525,40 @@ ArrayPropertyValues CreateComplexPropertyValues(object complexObject, InternalCo for (var i = 0; i < properties.Count; i++) { var property = properties[i]; - var getter = property.GetGetter(); - values[i] = getter.GetClrValue(complexObject); + var targetObject = NavigateToDeclaringType(complexObject, property.DeclaringType, complexType); + values[i] = targetObject == null ? null : property.GetGetter().GetClrValue(targetObject); } var complexPropertyValues = new ArrayPropertyValues(entry, values, null); foreach (var nestedComplexProperty in complexPropertyValues.ComplexCollectionProperties) { - var nestedCollection = (IList?)nestedComplexProperty.GetGetter().GetClrValue(complexObject); - var propertyValuesList = GetComplexCollectionPropertyValues(nestedComplexProperty, nestedCollection); - complexPropertyValues.SetComplexCollectionValue(nestedComplexProperty, propertyValuesList); + var targetObject = NavigateToDeclaringType(complexObject, nestedComplexProperty.DeclaringType, complexType); + var nestedCollection = targetObject == null ? null : (IList?)nestedComplexProperty.GetGetter().GetClrValue(targetObject); + var nestedPropertyValuesList = GetComplexCollectionPropertyValues(nestedComplexProperty, nestedCollection); + complexPropertyValues.SetComplexCollectionValue(nestedComplexProperty, nestedPropertyValuesList); } return complexPropertyValues; } + + static object? NavigateToDeclaringType(object root, ITypeBase declaringType, IRuntimeTypeBase rootType) + { + if (declaringType == rootType + || declaringType is not IComplexType ct + || UseOldBehavior37516) + { + return root; + } + + var chain = ct.ComplexProperty.GetChainToComplexProperty(fromEntity: false); + var target = root; + for (var i = 0; i < chain.Count && target != null; i++) + { + target = chain[i].GetGetter().GetClrValue(target); + } + + return target; + } } } diff --git a/test/EFCore.Tests/ChangeTracking/Internal/PropertyValuesTest.cs b/test/EFCore.Tests/ChangeTracking/Internal/PropertyValuesTest.cs index fe3def8e7ae..f701c8bedef 100644 --- a/test/EFCore.Tests/ChangeTracking/Internal/PropertyValuesTest.cs +++ b/test/EFCore.Tests/ChangeTracking/Internal/PropertyValuesTest.cs @@ -1,28 +1,33 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +#nullable enable + +using System.Collections; + namespace Microsoft.EntityFrameworkCore.ChangeTracking.Internal; public class PropertyValuesTest { [ConditionalFact] - public void Can_safely_get_originalvalue_and_currentvalue_with_tryget() + public void Can_safely_get_originalvalue_and_currentvalue_with_TryGetValue() { - // Arrange + var stateManager = CreateStateManager(mb => mb.Entity()); + const string NameValue = "Simple Name"; const string NewNameValue = "A New Name"; - using var ctx = new CurrentValuesDb(); - var entity = ctx.SimpleEntities.Add(new SimpleEntity { Name = NameValue }); - ctx.SaveChanges(); + var entity = new SimpleEntity { Name = NameValue }; - entity.Entity.Name = NewNameValue; + var entityEntry = stateManager.GetOrCreateEntry(entity); + entityEntry.SetEntityState(EntityState.Unchanged); + var entry = new EntityEntry(entityEntry); - // Act - var current = entity.CurrentValues.TryGetValue("Name", out var currentName); - var original = entity.OriginalValues.TryGetValue("Name", out var originalName); + entity.Name = NewNameValue; + + var current = entry.CurrentValues.TryGetValue("Name", out var currentName); + var original = entry.OriginalValues.TryGetValue("Name", out var originalName); - // Assert Assert.True(current); Assert.True(original); @@ -31,23 +36,24 @@ public void Can_safely_get_originalvalue_and_currentvalue_with_tryget() } [ConditionalFact] - public void Should_not_throw_error_when_property_do_not_exist() + public void TryGetValue_should_not_throw_error_when_property_does_not_exist() { - // Arrange + var stateManager = CreateStateManager(mb => mb.Entity()); + const string NameValue = "Simple Name"; const string NewNameValue = "A New Name"; - using var ctx = new CurrentValuesDb(); - var entity = ctx.SimpleEntities.Add(new SimpleEntity { Name = NameValue }); - ctx.SaveChanges(); + var entity = new SimpleEntity { Name = NameValue }; - entity.Entity.Name = NewNameValue; + var entityEntry = stateManager.GetOrCreateEntry(entity); + entityEntry.SetEntityState(EntityState.Unchanged); + var entry = new EntityEntry(entityEntry); - // Act - var current = entity.CurrentValues.TryGetValue("Non_Existent_Property", out var non_existent_current); - var original = entity.OriginalValues.TryGetValue("Non_Existent_Property", out var non_existent_original); + entity.Name = NewNameValue; + + var current = entry.CurrentValues.TryGetValue("Non_Existent_Property", out var non_existent_current); + var original = entry.OriginalValues.TryGetValue("Non_Existent_Property", out var non_existent_original); - // Assert Assert.False(current); Assert.False(original); @@ -55,22 +61,361 @@ public void Should_not_throw_error_when_property_do_not_exist() Assert.Null(non_existent_original); } - private class CurrentValuesDb : DbContext + [ConditionalTheory] + [ClassData(typeof(DataGenerator))] + public void ToObject_with_null_complex_property(bool? useOriginalValues) + { + var job = new Job { Id = 1, Name = "Job with No Error" }; + + var result = GetToObjectResult(job, useOriginalValues); + + Assert.Equal("Job with No Error", result.Name); + Assert.Null(result.Error); + } + + [ConditionalTheory] + [ClassData(typeof(DataGenerator))] + public void ToObject_with_all_nested_complex_properties_populated(bool? useOriginalValues) + { + var job = new Job + { + Id = 1, + Name = "Job with Error + Inner Errors", + Error = new RootJobError + { + Code = "500", + Message = "Internal Server Error", + InnerError = new JobError + { + Code = "501", + Message = "Not Implemented", + InnerError = new LeafJobError + { + Code = "502", + Message = "Bad Gateway" + } + } + } + }; + + var result = GetToObjectResult(job, useOriginalValues); + + Assert.Equal("Job with Error + Inner Errors", result.Name); + Assert.NotNull(result.Error); + Assert.Equal("500", result.Error!.Code); + Assert.NotNull(result.Error.InnerError); + Assert.Equal("501", result.Error.InnerError!.Code); + Assert.NotNull(result.Error.InnerError.InnerError); + Assert.Equal("502", result.Error.InnerError.InnerError!.Code); + } + + [ConditionalTheory] + [ClassData(typeof(DataGenerator))] + public void ToObject_with_null_nested_complex_property(bool? useOriginalValues) { - // ReSharper disable once UnusedAutoPropertyAccessor.Local - public DbSet SimpleEntities { get; set; } + var job = new Job + { + Id = 1, + Name = "Job with Error only", + Error = new RootJobError + { + Code = "400", + Message = "Bad Request" + } + }; + + var result = GetToObjectResult(job, useOriginalValues); - protected internal override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) - => optionsBuilder.UseInMemoryDatabase("DB1"); + Assert.Equal("Job with Error only", result.Name); + Assert.NotNull(result.Error); + Assert.Equal("400", result.Error!.Code); + Assert.Null(result.Error.InnerError); + } + + [ConditionalTheory] + [ClassData(typeof(DataGenerator))] + public void ToObject_with_complex_collection_containing_nested_nullable_complex_properties( + bool? useOriginalValues) + { + var job = new Job + { + Id = 1, + Name = "Test Job", + Errors = + [ + new RootJobError { Code = "400", Message = "Bad Request", InnerError = null }, + new RootJobError + { + Code = "500", + Message = "Server Error", + InnerError = new JobError { Code = "501", Message = "Not Implemented", InnerError = null } + }, + new RootJobError + { + Code = "503", + Message = "Service Unavailable", + InnerError = new JobError + { + Code = "504", + Message = "Gateway Timeout", + InnerError = new LeafJobError { Code = "505", Message = "Internal Error" } + } + } + ] + }; + + var result = GetToObjectResult(job, useOriginalValues); + + Assert.Equal("Test Job", result.Name); + Assert.Null(result.Error); + Assert.NotNull(result.Errors); + Assert.Equal(3, result.Errors.Count); + + Assert.Equal("400", result.Errors[0].Code); + Assert.Equal("Bad Request", result.Errors[0].Message); + Assert.Null(result.Errors[0].InnerError); + + Assert.Equal("500", result.Errors[1].Code); + Assert.Equal("Server Error", result.Errors[1].Message); + Assert.NotNull(result.Errors[1].InnerError); + Assert.Equal("501", result.Errors[1].InnerError!.Code); + Assert.Null(result.Errors[1].InnerError!.InnerError); + + Assert.Equal("503", result.Errors[2].Code); + Assert.NotNull(result.Errors[2].InnerError); + Assert.Equal("504", result.Errors[2].InnerError!.Code); + Assert.NotNull(result.Errors[2].InnerError!.InnerError); + Assert.Equal("505", result.Errors[2].InnerError!.InnerError!.Code); + } + + [ConditionalTheory] + [ClassData(typeof(DataGenerator))] + public void ToObject_with_null_complex_property_in_complex_collection_in_complex_collection( + bool? useOriginalValues) + { + var job = new Job + { + Id = 1, + Name = "Double Collection Test", + Errors = + [ + new RootJobError + { + Code = "400", + Message = "Bad Request", + InnerErrors = + [ + new JobError { Code = "401", Message = "Unauthorized", InnerError = null }, + new JobError + { + Code = "402", + Message = "Payment Required", + InnerError = new LeafJobError { Code = "403", Message = "Forbidden" } + } + ] + } + ] + }; + + var result = GetToObjectResult(job, useOriginalValues); + + Assert.Equal("Double Collection Test", result.Name); + Assert.Null(result.Error); + Assert.NotNull(result.Errors); + Assert.Single(result.Errors); + + var error = result.Errors[0]; + Assert.Equal("400", error.Code); + Assert.Null(error.InnerError); + Assert.NotNull(error.InnerErrors); + Assert.Equal(2, error.InnerErrors.Count); + + Assert.Equal("401", error.InnerErrors[0].Code); + Assert.Null(error.InnerErrors[0].InnerError); + + Assert.Equal("402", error.InnerErrors[1].Code); + Assert.NotNull(error.InnerErrors[1].InnerError); + Assert.Equal("403", error.InnerErrors[1].InnerError!.Code); + } + + [ConditionalTheory] + [ClassData(typeof(DataGenerator))] + public void ToObject_with_null_complex_property_in_complex_collection_element_in_complex_property( + bool? useOriginalValues) + { + var job = new Job + { + Id = 1, + Name = "Nested Collection Test", + Error = new RootJobError + { + Code = "500", + Message = "Server Error", + InnerErrors = + [ + new JobError { Code = "501", Message = "Not Implemented", InnerError = null }, + new JobError + { + Code = "502", + Message = "Bad Gateway", + InnerError = new LeafJobError { Code = "503", Message = "Service Unavailable" } + } + ] + } + }; + + var result = GetToObjectResult(job, useOriginalValues); + + Assert.Equal("Nested Collection Test", result.Name); + Assert.NotNull(result.Error); + Assert.Equal("500", result.Error!.Code); + Assert.Null(result.Error.InnerError); + Assert.NotNull(result.Error.InnerErrors); + Assert.Equal(2, result.Error.InnerErrors.Count); + + Assert.Equal("501", result.Error.InnerErrors[0].Code); + Assert.Null(result.Error.InnerErrors[0].InnerError); + + Assert.Equal("502", result.Error.InnerErrors[1].Code); + Assert.NotNull(result.Error.InnerErrors[1].InnerError); + Assert.Equal("503", result.Error.InnerErrors[1].InnerError!.Code); + } + + #region Helpers + + private static IStateManager CreateStateManager(Action buildModel) + { + var modelBuilder = InMemoryTestHelpers.Instance.CreateConventionBuilder(); + buildModel(modelBuilder); + var model = modelBuilder.FinalizeModel(); + return CreateStateManager(model); + } + + private static IStateManager CreateStateManager(IModel model) + { + var serviceProvider = InMemoryTestHelpers.Instance.CreateContextServices(model); + return serviceProvider.GetRequiredService(); + } + + private static void BuildJobModel(ModelBuilder mb) + => mb.Entity(b => + { + b.ComplexProperty(e => e.Error, eb => + { + eb.ComplexProperty(ne => ne.InnerError, neb => neb.ComplexProperty(dne => dne.InnerError)); + eb.ComplexCollection(ne => ne.InnerErrors, neb => neb.ComplexProperty(dne => dne.InnerError)); + }); + b.ComplexCollection(e => e.Errors, eb => + { + eb.ComplexProperty(ne => ne.InnerError, neb => neb.ComplexProperty(dne => dne.InnerError)); + eb.ComplexCollection(ne => ne.InnerErrors, neb => neb.ComplexProperty(dne => dne.InnerError)); + }); + }); + + private static Job GetToObjectResult(Job job, bool? useOriginalValues) + { + var stateManager = CreateStateManager(BuildJobModel); + + var internalEntry = stateManager.GetOrCreateEntry(job); + internalEntry.SetEntityState(EntityState.Unchanged); + var entry = new EntityEntry(internalEntry); + var targetValues = useOriginalValues == null + ? entry.CurrentValues.Clone() + : useOriginalValues.Value + ? entry.OriginalValues + : entry.CurrentValues; + + return (Job)targetValues.ToObject(); + } + + private static Dictionary ToDictionary(object obj, ITypeBase structuralType) + { + var dict = new Dictionary(); + var complexPropertyNames = new HashSet(); + + foreach (var complexProperty in structuralType.GetComplexProperties()) + { + complexPropertyNames.Add(complexProperty.Name); + var pi = obj.GetType().GetProperty(complexProperty.Name); + if (pi == null) + { + continue; + } + + var value = pi.GetValue(obj); + if (value == null) + { + dict[complexProperty.Name] = null; + } + else if (complexProperty.IsCollection && value is IList list) + { + var items = new List?>(); + for (var i = 0; i < list.Count; i++) + { + items.Add(list[i] == null ? null : ToDictionary(list[i]!, complexProperty.ComplexType)); + } + + dict[complexProperty.Name] = items; + } + else if (!complexProperty.IsCollection) + { + dict[complexProperty.Name] = ToDictionary(value, complexProperty.ComplexType); + } + } + + foreach (var pi in obj.GetType().GetProperties()) + { + if (!complexPropertyNames.Contains(pi.Name) && !dict.ContainsKey(pi.Name)) + { + dict[pi.Name] = pi.GetValue(obj); + } + } + + return dict; + } + + #endregion + + #region Model + + private class Job + { + public int Id { get; set; } + public string? Name { get; set; } + public RootJobError? Error { get; set; } + public List Errors { get; set; } = null!; + } + + // Change these to structs once #31411 is fixed + private class RootJobError + { + public string? Code { get; set; } + public string? Message { get; set; } + public JobError? InnerError { get; set; } + public List InnerErrors { get; set; } = null!; + } + + private class JobError + { + public string? Code { get; set; } + public string? Message { get; set; } + public LeafJobError? InnerError { get; set; } + public List InnerErrors { get; set; } = null!; + } + + private class LeafJobError + { + public string? Code { get; set; } + public string? Message { get; set; } } private class SimpleEntity { public int Id { get; set; } - public string Name { get; set; } + public string? Name { get; set; } - public IEnumerable RelatedEntities { get; set; } + public IEnumerable RelatedEntities { get; set; } = null!; } private class RelatedEntity @@ -79,8 +424,10 @@ private class RelatedEntity public int? SimpleEntityId { get; set; } - public SimpleEntity SimpleEntity { get; set; } + public SimpleEntity? SimpleEntity { get; set; } - public string Name { get; set; } + public string? Name { get; set; } } + + #endregion } From 5c272e7b9330f10a68677834eb72883f1e4b00f8 Mon Sep 17 00:00:00 2001 From: Andriy Svyryd Date: Thu, 26 Feb 2026 10:11:54 -0800 Subject: [PATCH 9/9] Remove UseOldBehavior37516 field from ArrayPropertyValues Removed the static field 'UseOldBehavior37516' that checks for a specific AppContext switch. --- src/EFCore/ChangeTracking/Internal/ArrayPropertyValues.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/EFCore/ChangeTracking/Internal/ArrayPropertyValues.cs b/src/EFCore/ChangeTracking/Internal/ArrayPropertyValues.cs index 764304bfd83..ab2a49f0feb 100644 --- a/src/EFCore/ChangeTracking/Internal/ArrayPropertyValues.cs +++ b/src/EFCore/ChangeTracking/Internal/ArrayPropertyValues.cs @@ -18,9 +18,6 @@ public class ArrayPropertyValues : PropertyValues private readonly List?[] _complexCollectionValues; private readonly bool[]? _nullComplexPropertyFlags; - private static readonly bool UseOldBehavior37516 = - AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue37516", out var enabled) && enabled; - /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in