diff --git a/Directory.Build.props b/Directory.Build.props index 7e5c028ecfa209..084308a0dd1fc1 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -192,6 +192,8 @@ false false + + false + diff --git a/eng/Subsets.props b/eng/Subsets.props index 96c5cf476590ee..4aa019b3c8499b 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -83,7 +83,7 @@ - + true diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 24fbe6c2292204..0bda01adaff44a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,5 +1,5 @@ - + https://github.com/dotnet/icu @@ -41,91 +41,91 @@ https://github.com/dotnet/llvm-project da5dd054a531e6fea65643b7e754285b73eab433 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 https://github.com/dotnet/runtime-assets @@ -263,33 +263,33 @@ https://github.com/dotnet/llvm-project da5dd054a531e6fea65643b7e754285b73eab433 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 https://github.com/dotnet/xharness @@ -303,9 +303,9 @@ https://github.com/dotnet/xharness e85bb14e85357ab678c2bcb0b6f2bac634fdd49b - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 https://dev.azure.com/dnceng/internal/_git/dotnet-optimization @@ -331,29 +331,29 @@ https://github.com/dotnet/runtime-assets 1cfc6ba21d0377b51f17eac4fdc2557f7b1e8693 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 - + https://github.com/dotnet/dotnet - 85778473549347b3e4bad3ea009e9438df7b11bb + 992d87b8b8e43f06040a52e6a949d12916879014 https://dev.azure.com/dnceng/internal/_git/dotnet-optimization diff --git a/eng/Versions.props b/eng/Versions.props index 6fe9ec30dcc4b7..7551861d49fbab 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -36,17 +36,17 @@ - 10.0.0-preview.25260.104 + 10.0.0-preview.25280.105 - 5.0.0-1.25260.104 + 5.0.0-1.25280.105 - 5.0.0-1.25260.104 - 5.0.0-1.25260.104 - 5.0.0-1.25260.104 + 5.0.0-1.25280.105 + 5.0.0-1.25280.105 + 5.0.0-1.25280.105 - 10.0.100-preview.5.25260.104 + 10.0.100-preview.5.25280.105 - 10.0.0-beta.25260.104 - 10.0.0-beta.25260.104 - 10.0.0-beta.25260.104 - 10.0.0-beta.25260.104 - 2.9.2-beta.25260.104 - 10.0.0-beta.25260.104 - 2.9.2-beta.25260.104 - 10.0.0-beta.25260.104 - 10.0.0-beta.25260.104 - 10.0.0-beta.25260.104 - 10.0.0-beta.25260.104 - 10.0.0-beta.25260.104 - 10.0.0-beta.25260.104 - 10.0.0-beta.25260.104 - 10.0.0-beta.25260.104 - 10.0.0-beta.25260.104 + 10.0.0-beta.25280.105 + 10.0.0-beta.25280.105 + 10.0.0-beta.25280.105 + 10.0.0-beta.25280.105 + 2.9.2-beta.25280.105 + 10.0.0-beta.25280.105 + 2.9.2-beta.25280.105 + 10.0.0-beta.25280.105 + 10.0.0-beta.25280.105 + 10.0.0-beta.25280.105 + 10.0.0-beta.25280.105 + 10.0.0-beta.25280.105 + 10.0.0-beta.25280.105 + 10.0.0-beta.25280.105 + 10.0.0-beta.25280.105 + 10.0.0-beta.25280.105 1.4.0 6.0.0-preview.1.102 - 10.0.0-preview.5.25260.104 + 10.0.0-preview.5.25280.105 6.0.0 - 10.0.0-preview.5.25260.104 - 10.0.0-preview.5.25260.104 + 10.0.0-preview.5.25280.105 + 10.0.0-preview.5.25280.105 6.0.0 4.6.1 @@ -128,16 +128,16 @@ 8.0.0 8.0.1 5.0.0 - 10.0.0-preview.5.25260.104 - 10.0.0-preview.5.25260.104 + 10.0.0-preview.5.25280.105 + 10.0.0-preview.5.25280.105 6.0.0 5.0.0 5.0.0 5.0.0 7.0.0 - 10.0.0-preview.5.25260.104 + 10.0.0-preview.5.25280.105 7.0.0 - 10.0.0-preview.5.25260.104 + 10.0.0-preview.5.25280.105 8.0.0 4.5.1 @@ -180,7 +180,7 @@ 2.0.0 17.10.0-beta1.24272.1 - 2.0.0-beta5.25260.104 + 2.0.0-beta5.25280.105 3.1.16 2.1.0 2.0.3 @@ -226,7 +226,7 @@ 9.0.0-preview-20241010.1 - 0.11.5-alpha.25260.104 + 0.11.5-alpha.25280.105 10.0.0-preview.5.25261.1 @@ -258,7 +258,7 @@ Note: when the name is updated, make sure to update dependency name in eng/pipelines/common/xplat-setup.yml like - DarcDependenciesChanged.Microsoft_NET_Workload_Emscripten_Current_Manifest-10_0_100_Transport --> - 10.0.100-preview.5.25260.104 + 10.0.100-preview.5.25280.105 $(MicrosoftNETWorkloadEmscriptenCurrentManifest100100TransportVersion) 1.1.87-gba258badda diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 6b3be1916fcaf5..ae2309e312d789 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -127,7 +127,7 @@ function Build { /p:Deploy=$deploy ` /p:Test=$test ` /p:Pack=$pack ` - /p:DotNetBuildRepo=$productBuild ` + /p:DotNetBuild=$productBuild ` /p:IntegrationTest=$integrationTest ` /p:PerformanceTest=$performanceTest ` /p:Sign=$sign ` diff --git a/eng/common/build.sh b/eng/common/build.sh index 36fba82a37930d..da906da202626d 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -129,14 +129,14 @@ while [[ $# > 0 ]]; do -pack) pack=true ;; - -sourcebuild|-sb) + -sourcebuild|-source-build|-sb) build=true source_build=true product_build=true restore=true pack=true ;; - -productBuild|-pb) + -productbuild|-product-build|-pb) build=true product_build=true restore=true @@ -241,7 +241,7 @@ function Build { /p:RepoRoot="$repo_root" \ /p:Restore=$restore \ /p:Build=$build \ - /p:DotNetBuildRepo=$product_build \ + /p:DotNetBuild=$product_build \ /p:DotNetBuildSourceOnly=$source_build \ /p:Rebuild=$rebuild \ /p:Test=$test \ diff --git a/eng/common/core-templates/steps/source-build.yml b/eng/common/core-templates/steps/source-build.yml index f2a0f347fdd67a..0dde553c3ebfbb 100644 --- a/eng/common/core-templates/steps/source-build.yml +++ b/eng/common/core-templates/steps/source-build.yml @@ -51,13 +51,12 @@ steps: ${{ coalesce(parameters.platform.buildScript, './build.sh') }} --ci \ --configuration $buildConfig \ --restore --build --pack -bl \ + --source-build \ ${{ parameters.platform.buildArguments }} \ $internalRuntimeDownloadArgs \ $targetRidArgs \ $baseRidArgs \ $portableBuildArgs \ - /p:DotNetBuildSourceOnly=true \ - /p:DotNetBuildRepo=true \ displayName: Build - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh index 36dbd45e1ce866..e889f439b8dc99 100755 --- a/eng/common/darc-init.sh +++ b/eng/common/darc-init.sh @@ -68,7 +68,7 @@ function InstallDarcCli { fi fi - local arcadeServicesSource="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" + local arcadeServicesSource="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" echo "Installing Darc CLI version $darcVersion..." echo "You may need to restart your command shell if this is the first dotnet tool you have installed." diff --git a/eng/common/templates/steps/vmr-sync.yml b/eng/common/templates/steps/vmr-sync.yml new file mode 100644 index 00000000000000..599afb6186b8fd --- /dev/null +++ b/eng/common/templates/steps/vmr-sync.yml @@ -0,0 +1,207 @@ +### These steps synchronize new code from product repositories into the VMR (https://github.com/dotnet/dotnet). +### They initialize the darc CLI and pull the new updates. +### Changes are applied locally onto the already cloned VMR (located in $vmrPath). + +parameters: +- name: targetRef + displayName: Target revision in dotnet/ to synchronize + type: string + default: $(Build.SourceVersion) + +- name: vmrPath + displayName: Path where the dotnet/dotnet is checked out to + type: string + default: $(Agent.BuildDirectory)/vmr + +- name: additionalSyncs + displayName: Optional list of package names whose repo's source will also be synchronized in the local VMR, e.g. NuGet.Protocol + type: object + default: [] + +steps: +- checkout: vmr + displayName: Clone dotnet/dotnet + path: vmr + clean: true + +- checkout: self + displayName: Clone $(Build.Repository.Name) + path: repo + fetchDepth: 0 + +# This step is needed so that when we get a detached HEAD / shallow clone, +# we still pull the commit into the temporary repo clone to use it during the sync. +# Also unshallow the clone so that forwardflow command would work. +- script: | + git branch repo-head + git rev-parse HEAD + 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" + displayName: Set git author to dotnet-maestro[bot] + workingDirectory: ${{ parameters.vmrPath }} + +- script: | + ./eng/common/vmr-sync.sh \ + --vmr ${{ parameters.vmrPath }} \ + --tmp $(Agent.TempDirectory) \ + --azdev-pat '$(dn-bot-all-orgs-code-r)' \ + --ci \ + --debug + + if [ "$?" -ne 0 ]; then + echo "##vso[task.logissue type=error]Failed to synchronize the VMR" + exit 1 + fi + displayName: Sync repo into VMR (Unix) + condition: ne(variables['Agent.OS'], 'Windows_NT') + workingDirectory: $(Agent.BuildDirectory)/repo + +- script: | + git config --global diff.astextplain.textconv echo + git config --system core.longpaths true + displayName: Configure Windows git (longpaths, astextplain) + condition: eq(variables['Agent.OS'], 'Windows_NT') + +- powershell: | + ./eng/common/vmr-sync.ps1 ` + -vmr ${{ parameters.vmrPath }} ` + -tmp $(Agent.TempDirectory) ` + -azdevPat '$(dn-bot-all-orgs-code-r)' ` + -ci ` + -debugOutput + + if ($LASTEXITCODE -ne 0) { + echo "##vso[task.logissue type=error]Failed to synchronize the VMR" + exit 1 + } + displayName: Sync repo into VMR (Windows) + condition: eq(variables['Agent.OS'], 'Windows_NT') + workingDirectory: $(Agent.BuildDirectory)/repo + +- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: + - task: CopyFiles@2 + displayName: Collect failed patches + condition: failed() + inputs: + SourceFolder: '$(Agent.TempDirectory)' + Contents: '*.patch' + TargetFolder: '$(Build.ArtifactStagingDirectory)/FailedPatches' + + - publish: '$(Build.ArtifactStagingDirectory)/FailedPatches' + artifact: $(System.JobDisplayName)_FailedPatches + displayName: Upload failed patches + condition: failed() + +- ${{ each assetName in parameters.additionalSyncs }}: + # The vmr-sync script ends up staging files in the local VMR so we have to commit those + - script: + git commit --allow-empty -am "Forward-flow $(Build.Repository.Name)" + displayName: Commit local VMR changes + workingDirectory: ${{ parameters.vmrPath }} + + - script: | + set -ex + + echo "Searching for details of asset ${{ assetName }}..." + + # Use darc to get dependencies information + dependencies=$(./.dotnet/dotnet darc get-dependencies --name '${{ assetName }}' --ci) + + # Extract repository URL and commit hash + repository=$(echo "$dependencies" | grep 'Repo:' | sed 's/Repo:[[:space:]]*//' | head -1) + + if [ -z "$repository" ]; then + echo "##vso[task.logissue type=error]Asset ${{ assetName }} not found in the dependency list" + exit 1 + fi + + commit=$(echo "$dependencies" | grep 'Commit:' | sed 's/Commit:[[:space:]]*//' | head -1) + + echo "Updating the VMR from $repository / $commit..." + cd .. + git clone $repository ${{ assetName }} + cd ${{ assetName }} + git checkout $commit + git branch "sync/$commit" + + ./eng/common/vmr-sync.sh \ + --vmr ${{ parameters.vmrPath }} \ + --tmp $(Agent.TempDirectory) \ + --azdev-pat '$(dn-bot-all-orgs-code-r)' \ + --ci \ + --debug + + if [ "$?" -ne 0 ]; then + echo "##vso[task.logissue type=error]Failed to synchronize the VMR" + exit 1 + fi + displayName: Sync ${{ assetName }} into (Unix) + condition: ne(variables['Agent.OS'], 'Windows_NT') + workingDirectory: $(Agent.BuildDirectory)/repo + + - powershell: | + $ErrorActionPreference = 'Stop' + + Write-Host "Searching for details of asset ${{ assetName }}..." + + $dependencies = .\.dotnet\dotnet darc get-dependencies --name '${{ assetName }}' --ci + + $repository = $dependencies | Select-String -Pattern 'Repo:\s+([^\s]+)' | Select-Object -First 1 + $repository -match 'Repo:\s+([^\s]+)' | Out-Null + $repository = $matches[1] + + if ($repository -eq $null) { + Write-Error "Asset ${{ assetName }} not found in the dependency list" + exit 1 + } + + $commit = $dependencies | Select-String -Pattern 'Commit:\s+([^\s]+)' | Select-Object -First 1 + $commit -match 'Commit:\s+([^\s]+)' | Out-Null + $commit = $matches[1] + + Write-Host "Updating the VMR from $repository / $commit..." + cd .. + git clone $repository ${{ assetName }} + cd ${{ assetName }} + git checkout $commit + git branch "sync/$commit" + + .\eng\common\vmr-sync.ps1 ` + -vmr ${{ parameters.vmrPath }} ` + -tmp $(Agent.TempDirectory) ` + -azdevPat '$(dn-bot-all-orgs-code-r)' ` + -ci ` + -debugOutput + + if ($LASTEXITCODE -ne 0) { + echo "##vso[task.logissue type=error]Failed to synchronize the VMR" + exit 1 + } + displayName: Sync ${{ assetName }} into (Windows) + condition: ne(variables['Agent.OS'], 'Windows_NT') + workingDirectory: $(Agent.BuildDirectory)/repo diff --git a/eng/common/templates/vmr-build-pr.yml b/eng/common/templates/vmr-build-pr.yml new file mode 100644 index 00000000000000..670cf32c3bd1fa --- /dev/null +++ b/eng/common/templates/vmr-build-pr.yml @@ -0,0 +1,33 @@ +trigger: none +pr: + branches: + include: + - main + - release/* + paths: + exclude: + - documentation/* + - README.md + - CODEOWNERS + +variables: +- template: /eng/common/templates/variables/pool-providers.yml@self + +- name: skipComponentGovernanceDetection # we run CG on internal builds only + value: true + +- name: Codeql.Enabled # we run CodeQL on internal builds only + value: false + +resources: + repositories: + - repository: vmr + type: github + name: dotnet/dotnet + endpoint: dotnet + +stages: +- template: /eng/pipelines/templates/stages/vmr-build.yml@vmr + parameters: + isBuiltFromVmr: false + scope: lite diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 7373e5305465d7..5f40a3f8238a8b 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -68,8 +68,6 @@ $ErrorActionPreference = 'Stop' # True if the build is a product build [bool]$productBuild = if (Test-Path variable:productBuild) { $productBuild } else { $false } -[String[]]$properties = if (Test-Path variable:properties) { $properties } else { @() } - function Create-Directory ([string[]] $path) { New-Item -Path $path -Force -ItemType 'Directory' | Out-Null } @@ -853,7 +851,7 @@ function MSBuild-Core() { # When running on Azure Pipelines, override the returned exit code to avoid double logging. # Skip this when the build is a child of the VMR orchestrator build. - if ($ci -and $env:SYSTEM_TEAMPROJECT -ne $null -and !$productBuild -and -not($properties -like "*DotNetBuildRepo=true*")) { + if ($ci -and $env:SYSTEM_TEAMPROJECT -ne $null -and !$productBuild) { Write-PipelineSetResult -Result "Failed" -Message "msbuild execution failed." # Exiting with an exit code causes the azure pipelines task to log yet another "noise" error # The above Write-PipelineSetResult will cause the task to be marked as failure without adding yet another error diff --git a/eng/common/tools.sh b/eng/common/tools.sh index cc007b1f15ad05..25f5932eee982a 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -507,7 +507,7 @@ function MSBuild-Core { # When running on Azure Pipelines, override the returned exit code to avoid double logging. # Skip this when the build is a child of the VMR orchestrator build. - if [[ "$ci" == true && -n ${SYSTEM_TEAMPROJECT:-} && "$product_build" != true && "$properties" != *"DotNetBuildRepo=true"* ]]; then + if [[ "$ci" == true && -n ${SYSTEM_TEAMPROJECT:-} && "$product_build" != true ]]; then Write-PipelineSetResult -result "Failed" -message "msbuild execution failed." # Exiting with an exit code causes the azure pipelines task to log yet another "noise" error # The above Write-PipelineSetResult will cause the task to be marked as failure without adding yet another error diff --git a/eng/common/vmr-sync.ps1 b/eng/common/vmr-sync.ps1 new file mode 100755 index 00000000000000..8c3c91ce8dede9 --- /dev/null +++ b/eng/common/vmr-sync.ps1 @@ -0,0 +1,138 @@ +<# +.SYNOPSIS + +This script is used for synchronizing the current repository into a local VMR. +It pulls the current repository's code into the specified VMR directory for local testing or +Source-Build validation. + +.DESCRIPTION + +The tooling used for synchronization will clone the VMR repository into a temporary folder if +it does not already exist. These clones can be reused in future synchronizations, so it is +recommended to dedicate a folder for this to speed up re-runs. + +.EXAMPLE + Synchronize current repository into a local VMR: + ./vmr-sync.ps1 -vmrDir "$HOME/repos/dotnet" -tmpDir "$HOME/repos/tmp" + +.PARAMETER tmpDir +Required. Path to the temporary folder where repositories will be cloned + +.PARAMETER vmrBranch +Optional. Branch of the 'dotnet/dotnet' repo to synchronize. The VMR will be checked out to this branch + +.PARAMETER azdevPat +Optional. Azure DevOps PAT to use for cloning private repositories. + +.PARAMETER vmrDir +Optional. Path to the dotnet/dotnet repository. When null, gets cloned to the temporary folder + +.PARAMETER debugOutput +Optional. Enables debug logging in the darc vmr command. + +.PARAMETER ci +Optional. Denotes that the script is running in a CI environment. +#> +param ( + [Parameter(Mandatory=$true, HelpMessage="Path to the temporary folder where repositories will be cloned")] + [string][Alias('t', 'tmp')]$tmpDir, + [string][Alias('b', 'branch')]$vmrBranch, + [string]$remote, + [string]$azdevPat, + [string][Alias('v', 'vmr')]$vmrDir, + [switch]$ci, + [switch]$debugOutput +) + +function Fail { + Write-Host "> $($args[0])" -ForegroundColor 'Red' +} + +function Highlight { + Write-Host "> $($args[0])" -ForegroundColor 'Cyan' +} + +$verbosity = 'verbose' +if ($debugOutput) { + $verbosity = 'debug' +} +# Validation + +if (-not $tmpDir) { + Fail "Missing -tmpDir argument. Please specify the path to the temporary folder where the repositories will be cloned" + exit 1 +} + +# Sanitize the input + +if (-not $vmrDir) { + $vmrDir = Join-Path $tmpDir 'dotnet' +} + +if (-not (Test-Path -Path $tmpDir -PathType Container)) { + New-Item -ItemType Directory -Path $tmpDir | Out-Null +} + +# Prepare the VMR + +if (-not (Test-Path -Path $vmrDir -PathType Container)) { + Highlight "Cloning 'dotnet/dotnet' into $vmrDir.." + git clone https://github.com/dotnet/dotnet $vmrDir + + if ($vmrBranch) { + git -C $vmrDir switch -c $vmrBranch + } +} +else { + if ((git -C $vmrDir diff --quiet) -eq $false) { + Fail "There are changes in the working tree of $vmrDir. Please commit or stash your changes" + exit 1 + } + + if ($vmrBranch) { + Highlight "Preparing $vmrDir" + git -C $vmrDir checkout $vmrBranch + git -C $vmrDir pull + } +} + +Set-StrictMode -Version Latest + +# Prepare darc + +Highlight 'Installing .NET, preparing the tooling..' +. .\eng\common\tools.ps1 +$dotnetRoot = InitializeDotNetCli -install:$true +$dotnet = "$dotnetRoot\dotnet.exe" +& "$dotnet" tool restore + +Highlight "Starting the synchronization of VMR.." + +# Synchronize the VMR +$darcArgs = ( + "darc", "vmr", "forwardflow", + "--tmp", $tmpDir, + "--$verbosity", + $vmrDir +) + +if ($ci) { + $darcArgs += ("--ci") +} + +if ($azdevPat) { + $darcArgs += ("--azdev-pat", $azdevPat) +} + +& "$dotnet" $darcArgs + +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 +} diff --git a/eng/common/vmr-sync.sh b/eng/common/vmr-sync.sh new file mode 100755 index 00000000000000..86d77ccf5b4822 --- /dev/null +++ b/eng/common/vmr-sync.sh @@ -0,0 +1,205 @@ +#!/bin/bash + +### This script is used for synchronizing the current repository into a local VMR. +### It pulls the current repository's code into the specified VMR directory for local testing or +### Source-Build validation. +### +### The tooling used for synchronization will clone the VMR repository into a temporary folder if +### it does not already exist. These clones can be reused in future synchronizations, so it is +### recommended to dedicate a folder for this to speed up re-runs. +### +### USAGE: +### Synchronize current repository into a local VMR: +### ./vmr-sync.sh --tmp "$HOME/repos/tmp" "$HOME/repos/dotnet" +### +### Options: +### -t, --tmp, --tmp-dir PATH +### Required. Path to the temporary folder where repositories will be cloned +### +### -b, --branch, --vmr-branch BRANCH_NAME +### Optional. Branch of the 'dotnet/dotnet' repo to synchronize. The VMR will be checked out to this branch +### +### --debug +### Optional. Turns on the most verbose logging for the VMR tooling +### +### --remote name:URI +### Optional. Additional remote to use during the synchronization +### This can be used to synchronize to a commit from a fork of the repository +### Example: 'runtime:https://github.com/yourfork/runtime' +### +### --azdev-pat +### Optional. Azure DevOps PAT to use for cloning private repositories. +### +### -v, --vmr, --vmr-dir PATH +### Optional. Path to the dotnet/dotnet repository. When null, gets cloned to the temporary folder + +source="${BASH_SOURCE[0]}" + +# resolve $source until the file is no longer a symlink +while [[ -h "$source" ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +function print_help () { + sed -n '/^### /,/^$/p' "$source" | cut -b 5- +} + +COLOR_RED=$(tput setaf 1 2>/dev/null || true) +COLOR_CYAN=$(tput setaf 6 2>/dev/null || true) +COLOR_CLEAR=$(tput sgr0 2>/dev/null || true) +COLOR_RESET=uniquesearchablestring +FAILURE_PREFIX='> ' + +function fail () { + echo "${COLOR_RED}$FAILURE_PREFIX${1//${COLOR_RESET}/${COLOR_RED}}${COLOR_CLEAR}" >&2 +} + +function highlight () { + echo "${COLOR_CYAN}$FAILURE_PREFIX${1//${COLOR_RESET}/${COLOR_CYAN}}${COLOR_CLEAR}" +} + +tmp_dir='' +vmr_dir='' +vmr_branch='' +additional_remotes='' +verbosity=verbose +azdev_pat='' +ci=false + +while [[ $# -gt 0 ]]; do + opt="$(echo "$1" | tr "[:upper:]" "[:lower:]")" + case "$opt" in + -t|--tmp|--tmp-dir) + tmp_dir=$2 + shift + ;; + -v|--vmr|--vmr-dir) + vmr_dir=$2 + shift + ;; + -b|--branch|--vmr-branch) + vmr_branch=$2 + shift + ;; + --remote) + additional_remotes="$additional_remotes $2" + shift + ;; + --azdev-pat) + azdev_pat=$2 + shift + ;; + --ci) + ci=true + ;; + -d|--debug) + verbosity=debug + ;; + -h|--help) + print_help + exit 0 + ;; + *) + fail "Invalid argument: $1" + print_help + exit 1 + ;; + esac + + shift +done + +# Validation + +if [[ -z "$tmp_dir" ]]; then + fail "Missing --tmp-dir argument. Please specify the path to the temporary folder where the repositories will be cloned" + exit 1 +fi + +# Sanitize the input + +if [[ -z "$vmr_dir" ]]; then + vmr_dir="$tmp_dir/dotnet" +fi + +if [[ ! -d "$tmp_dir" ]]; then + mkdir -p "$tmp_dir" +fi + +if [[ "$verbosity" == "debug" ]]; then + set -x +fi + +# Prepare the VMR + +if [[ ! -d "$vmr_dir" ]]; then + highlight "Cloning 'dotnet/dotnet' into $vmr_dir.." + git clone https://github.com/dotnet/dotnet "$vmr_dir" + + if [[ -n "$vmr_branch" ]]; then + git -C "$vmr_dir" switch -c "$vmr_branch" + fi +else + if ! git -C "$vmr_dir" diff --quiet; then + fail "There are changes in the working tree of $vmr_dir. Please commit or stash your changes" + exit 1 + fi + + if [[ -n "$vmr_branch" ]]; then + highlight "Preparing $vmr_dir" + git -C "$vmr_dir" checkout "$vmr_branch" + git -C "$vmr_dir" pull + fi +fi + +set -e + +# Prepare darc + +highlight 'Installing .NET, preparing the tooling..' +source "./eng/common/tools.sh" +InitializeDotNetCli true +dotnetDir=$( cd ./.dotnet/; pwd -P ) +dotnet=$dotnetDir/dotnet +"$dotnet" tool restore + +highlight "Starting the synchronization of VMR.." +set +e + +if [[ -n "$additional_remotes" ]]; then + additional_remotes="--additional-remotes $additional_remotes" +fi + +if [[ -n "$azdev_pat" ]]; then + azdev_pat="--azdev-pat $azdev_pat" +fi + +ci_arg='' +if [[ "$ci" == "true" ]]; then + ci_arg="--ci" +fi + +# Synchronize the VMR + +"$dotnet" darc vmr forwardflow \ + --tmp "$tmp_dir" \ + $azdev_pat \ + --$verbosity \ + $ci_arg \ + $additional_remotes \ + "$vmr_dir" + +if [[ $? == 0 ]]; then + highlight "Synchronization succeeded" +else + fail "Synchronization of repo to VMR failed!" + fail "'$vmr_dir' 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 --debug 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 +fi diff --git a/eng/native/signing/auth.json b/eng/native/signing/auth.json index 6d0230d8b63f75..a467bd95b55536 100644 --- a/eng/native/signing/auth.json +++ b/eng/native/signing/auth.json @@ -1,23 +1,20 @@ { "Version" : "1.0.0", - "AuthenticationType" : "AAD_CERT", + "AuthenticationType" : "AAD_MSI_WIF", "TenantId" : "975f013f-7f24-47e8-a7d3-abc4752bf346", "ClientId" : "22346933-af99-4e94-97d5-7fa1dcf4bba6", - "AuthCert" : - { - "SubjectName" : "CN=22346933-af99-4e94-97d5-7fa1dcf4bba6.microsoft.com", - "StoreLocation" : "CurrentUser", - "StoreName": "My", - "SendX5c" : "true", - "WithAzureRegion": false - }, + "EsrpClientId": "22346933-af99-4e94-97d5-7fa1dcf4bba6", "RequestSigningCert" : { "GetCertFromKeyVault" : true, "KeyVaultName": "clrdiag-esrp-pme", "KeyVaultCertName": "dac-dnceng-esrpclient-cert", "SendX5c": false, - "WithAzureRegion": false + "WithAzureRegion": false, + "StoreLocation": null, + "StoreName": null, + "SubjectName": null }, - "OAuthToken": null + "OAuthToken": null, + "FederatedTokenData": {} } diff --git a/eng/pipelines/coreclr/templates/install-diagnostic-certs.yml b/eng/pipelines/coreclr/templates/install-diagnostic-certs.yml deleted file mode 100644 index 32fb99b3590ba3..00000000000000 --- a/eng/pipelines/coreclr/templates/install-diagnostic-certs.yml +++ /dev/null @@ -1,39 +0,0 @@ -parameters: - isOfficialBuild: false - certNames: [] - vaultName: '' - azureSubscription: '' - scriptRoot: '$(Build.SourcesDirectory)' - -steps: -- ${{ if and(eq(parameters.isOfficialBuild, true), ne(variables['Build.Reason'], 'PullRequest'), or(startswith(variables['Build.SourceBranch'], 'refs/heads/release/'), startswith(variables['Build.SourceBranch'], 'refs/heads/internal/release/'), startswith(variables['Build.SourceBranch'], 'refs/heads/reltest/')), not(endsWith(variables['Build.SourceBranch'], '-staging'))) }}: - - task: AzureKeyVault@2 - inputs: - azureSubscription: ${{ parameters.azureSubscription }} - KeyVaultName: ${{ parameters.vaultName }} - SecretsFilter: ${{ join(',', parameters.certNames) }} - displayName: 'Download secrets: Diagnostic Certificates' - - - task: NuGetCommand@2 - displayName: Install ESRPClient Tool - inputs: - command: 'custom' - arguments: 'install microsoft.esrpclient - -Source https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json - -DependencyVersion Highest -OutputDirectory $(Build.StagingDirectory)' - - - powershell: | - eng/pipelines/install-diagnostic-certs.ps1 "${{ join(',', parameters.certNames) }}" - $esrpclient = Get-ChildItem -Path '$(Build.StagingDirectory)\microsoft.esrpclient*' -Filter esrpclient.exe -Recurse | Select-Object -First 1 | select -ExpandProperty FullName - - if ($esrpclient -eq $null) { - throw "Failed to find esrpclient.exe in $(Build.StagingDirectory)" - } - - $signArgs = "/p:DotNetEsrpToolPath=$esrpclient" - echo "##vso[task.setvariable variable=_SignDiagnosticFilesArgs;]$signArgs" - displayName: 'Install diagnostic certificates' - workingDirectory: ${{ parameters.scriptRoot }} - env: - ${{ each cert in parameters.certNames }}: - ${{ cert }}: $(${{ cert }}) diff --git a/eng/pipelines/coreclr/templates/remove-diagnostic-certs.yml b/eng/pipelines/coreclr/templates/remove-diagnostic-certs.yml deleted file mode 100644 index c510ea8f177cf7..00000000000000 --- a/eng/pipelines/coreclr/templates/remove-diagnostic-certs.yml +++ /dev/null @@ -1,11 +0,0 @@ -parameters: - isOfficialBuild: false - scriptRoot: '$(Build.SourcesDirectory)' - -steps: -- ${{ if and(eq(parameters.isOfficialBuild, true), ne(variables['Build.Reason'], 'PullRequest'), or(startswith(variables['Build.SourceBranch'], 'refs/heads/release/'), startswith(variables['Build.SourceBranch'], 'refs/heads/internal/release/'), startswith(variables['Build.SourceBranch'], 'refs/heads/reltest/')), not(endsWith(variables['Build.SourceBranch'], '-staging'))) }}: - - powershell: | - eng/pipelines/remove-diagnostic-certs.ps1 "$(DacCertificateThumbprints)" - workingDirectory: ${{ parameters.scriptRoot }} - displayName: 'Remove Diagnostic Certificates' - condition: always() diff --git a/eng/pipelines/install-diagnostic-certs.ps1 b/eng/pipelines/install-diagnostic-certs.ps1 deleted file mode 100644 index 74d3c43f75739a..00000000000000 --- a/eng/pipelines/install-diagnostic-certs.ps1 +++ /dev/null @@ -1,32 +0,0 @@ -[CmdletBinding()] -param( - [string] - [Parameter(Mandatory)] - $certList -) -# Required for the pipeline logging functions -$ci = $true -. $PSScriptRoot/../common/pipeline-logging-functions.ps1 - -$certs = $certList -split ',' -$thumbprints = @() -$certCollection = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2Collection -foreach ($cert in $certs) -{ - $certBytes = [System.Convert]::FromBase64String($(Get-Item "Env:$cert").Value) - $certCollection.Import($certBytes,$null, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::PersistKeySet) -} - -foreach ($cert in $certCollection) -{ - Write-Host "Installed certificate '$($cert.Thumbprint)' with subject: '$($cert.Subject)'" - $thumbprints += $cert.Thumbprint -} - -$store = Get-Item -Path Cert:\CurrentUser\My -$store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]::ReadWrite) -$store.AddRange($certCollection) -$store.Close() - -Write-PipelineSetVariable -name "DacCertificateThumbprints" -Value "$($thumbprints -join ',')" -IsMultiJobVariable $false -Write-Host "Successfully installed diagnostic certificates" diff --git a/eng/pipelines/remove-diagnostic-certs.ps1 b/eng/pipelines/remove-diagnostic-certs.ps1 deleted file mode 100644 index 3ebea9f3e287ae..00000000000000 --- a/eng/pipelines/remove-diagnostic-certs.ps1 +++ /dev/null @@ -1,22 +0,0 @@ -[CmdletBinding()] -param( - [string] - [Parameter(Mandatory)] - $thumbprintList -) - -$thumbprints = $thumbprintList -split ',' -$store = Get-Item -Path Cert:\CurrentUser\My -$store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]::ReadWrite) -foreach ($thumbprint in $thumbprints) -{ - $cert = $store.Certificates.Find([System.Security.Cryptography.X509Certificates.X509FindType]::FindByThumbprint, $thumbprint, $false) - if ($null -eq $cert) - { - Write-Host "Certificate with thumbprint '$thumbprint' not found in the user store." - } - $store.RemoveRange($cert) - Write-Host "Removed certificate '$thumbprint'" -} -$store.Close() -Write-Host "Successfully removed diagnostic certificates" diff --git a/global.json b/global.json index 8616c8a6541983..2bb16df5c8919d 100644 --- a/global.json +++ b/global.json @@ -1,18 +1,18 @@ { "sdk": { - "version": "10.0.100-preview.3.25201.16", + "version": "10.0.100-preview.5.25265.106", "allowPrerelease": true, "rollForward": "major" }, "tools": { - "dotnet": "10.0.100-preview.3.25201.16" + "dotnet": "10.0.100-preview.5.25265.106" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25260.104", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.25260.104", - "Microsoft.DotNet.SharedFramework.Sdk": "10.0.0-beta.25260.104", + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25280.105", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.25280.105", + "Microsoft.DotNet.SharedFramework.Sdk": "10.0.0-beta.25280.105", "Microsoft.Build.NoTargets": "3.7.0", "Microsoft.Build.Traversal": "3.4.0", - "Microsoft.NET.Sdk.IL": "10.0.0-preview.5.25260.104" + "Microsoft.NET.Sdk.IL": "10.0.0-preview.5.25280.105" } } diff --git a/src/coreclr/debug/daccess/request.cpp b/src/coreclr/debug/daccess/request.cpp index 465ead557bb14e..4f95b4bd324a76 100644 --- a/src/coreclr/debug/daccess/request.cpp +++ b/src/coreclr/debug/daccess/request.cpp @@ -5076,7 +5076,7 @@ namespace TADDR ClrDataAccess::GetIdentityForManagedObjectWrapper(TADDR mow) { PTR_ManagedObjectWrapper pMOW = dac_cast(mow); - // Replicate the logic for ManagedObjectWrapper.As(IID_IUnknown) + // Replicate the logic for _wrapper.As(IID_IUnknown) if ((pMOW->GetFlags() & InteropLib::Com::CreateComInterfaceFlagsEx::CallerDefinedIUnknown) == InteropLib::Com::CreateComInterfaceFlagsEx::None) { // We have the standard IUnknown implementation, so grab it from its known location. @@ -5173,7 +5173,7 @@ HRESULT ClrDataAccess::GetObjectComWrappersData(CLRDATA_ADDRESS objAddr, CLRDATA for (unsigned int i = 0; i < count; i++) { MOWHOLDERREF pMOWRef = (MOWHOLDERREF)pListItems->GetAt(i); - PTR_ManagedObjectWrapper pMOW = PTR_ManagedObjectWrapper(dac_cast(pMOWRef->ManagedObjectWrapper)); + PTR_ManagedObjectWrapper pMOW = PTR_ManagedObjectWrapper(dac_cast(pMOWRef->_wrapper)); // Now that we have the managed object wrapper, we need to figure out the COM identity of it. TADDR pComIdentity = GetIdentityForManagedObjectWrapper(dac_cast(pMOW)); diff --git a/src/coreclr/debug/ee/controller.cpp b/src/coreclr/debug/ee/controller.cpp index fc5204bb3cffea..547d2cf686696a 100644 --- a/src/coreclr/debug/ee/controller.cpp +++ b/src/coreclr/debug/ee/controller.cpp @@ -4469,19 +4469,7 @@ bool DebuggerController::DispatchNativeException(EXCEPTION_RECORD *pException, ThisFunctionMayHaveTriggerAGC(); } #endif -#ifdef FEATURE_SPECIAL_USER_MODE_APC - if (pCurThread->m_State & Thread::TS_SSToExitApcCall) - { - if (!CheckActivationSafePoint(GetIP(pContext))) - { - return FALSE; - } - pCurThread->SetThreadState(Thread::TS_SSToExitApcCallDone); - pCurThread->ResetThreadState(Thread::TS_SSToExitApcCall); - DebuggerController::UnapplyTraceFlag(pCurThread); - pCurThread->MarkForSuspensionAndWait(Thread::TS_DebugSuspendPending); - } -#endif + // Must restore the filter context. After the filter context is gone, we're diff --git a/src/coreclr/debug/ee/debugger.cpp b/src/coreclr/debug/ee/debugger.cpp index 1da42283144c4f..5a597bdf6ef166 100644 --- a/src/coreclr/debug/ee/debugger.cpp +++ b/src/coreclr/debug/ee/debugger.cpp @@ -15001,14 +15001,6 @@ HRESULT Debugger::FuncEvalSetup(DebuggerIPCE_FuncEvalInfo *pEvalInfo, return CORDBG_E_ILLEGAL_IN_STACK_OVERFLOW; } -#ifdef FEATURE_SPECIAL_USER_MODE_APC - if (pThread->m_hasPendingActivation) - { - _ASSERTE(!"Should never get here with a pending activation. (Debugger::FuncEvalSetup)"); - return CORDBG_E_ILLEGAL_IN_NATIVE_CODE; - } -#endif - bool fInException = pEvalInfo->evalDuringException; // The thread has to be at a GC safe place for now, just in case the func eval causes a collection. Processing an @@ -16780,15 +16772,6 @@ void Debugger::ExternalMethodFixupNextStep(PCODE address) { DebuggerController::DispatchExternalMethodFixup(address); } -#ifdef FEATURE_SPECIAL_USER_MODE_APC -void Debugger::SingleStepToExitApcCall(Thread* pThread, CONTEXT *interruptedContext) -{ - pThread->SetThreadState(Thread::TS_SSToExitApcCall); - g_pEEInterface->SetThreadFilterContext(pThread, interruptedContext); - DebuggerController::EnableSingleStep(pThread); - g_pEEInterface->SetThreadFilterContext(pThread, NULL); -} -#endif //FEATURE_SPECIAL_USER_MODE_APC #endif //DACCESS_COMPILE unsigned FuncEvalFrame::GetFrameAttribs_Impl(void) diff --git a/src/coreclr/debug/ee/debugger.h b/src/coreclr/debug/ee/debugger.h index d13b6790e94b7d..72457b28c22b24 100644 --- a/src/coreclr/debug/ee/debugger.h +++ b/src/coreclr/debug/ee/debugger.h @@ -3061,9 +3061,6 @@ class Debugger : public DebugInterface // Used by Debugger::FirstChanceNativeException to update the context from out of process void SendSetThreadContextNeeded(CONTEXT *context, DebuggerSteppingInfo *pDebuggerSteppingInfo = NULL); BOOL IsOutOfProcessSetContextEnabled(); -#ifdef FEATURE_SPECIAL_USER_MODE_APC - void SingleStepToExitApcCall(Thread* pThread, CONTEXT *interruptedContext); -#endif // FEATURE_SPECIAL_USER_MODE_APC }; diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/TrackerObjectManager.NativeAot.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/TrackerObjectManager.NativeAot.cs index edb227499a13ea..683747ea56dc8e 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/TrackerObjectManager.NativeAot.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/TrackerObjectManager.NativeAot.cs @@ -164,13 +164,13 @@ internal static unsafe void WalkExternalTrackerObjects() nativeObjectWrapper.TrackerObject != IntPtr.Zero) { FindReferenceTargetsCallback.s_currentRootObjectHandle = nativeObjectWrapper.ProxyHandle; - if (IReferenceTracker.FindTrackerTargets(nativeObjectWrapper.TrackerObject, (IntPtr)Unsafe.AsPointer(in s_findReferencesTargetCallback)) != HResults.S_OK) + int hr = IReferenceTracker.FindTrackerTargets(nativeObjectWrapper.TrackerObject, (IntPtr)Unsafe.AsPointer(in s_findReferencesTargetCallback)); + FindReferenceTargetsCallback.s_currentRootObjectHandle = default; + if (hr < 0) { walkFailed = true; - FindReferenceTargetsCallback.s_currentRootObjectHandle = default; break; } - FindReferenceTargetsCallback.s_currentRootObjectHandle = default; } } @@ -227,16 +227,23 @@ private static unsafe int IFindReferenceTargetsCallback_FoundTrackerTarget(IntPt { if (referenceTrackerTarget == IntPtr.Zero) { - return HResults.E_INVALIDARG; + return HResults.E_POINTER; + } + + object sourceObject = s_currentRootObjectHandle.Target!; + + if (!TryGetObject(referenceTrackerTarget, out object? targetObject)) + { + return HResults.S_FALSE; } - if (TryGetObject(referenceTrackerTarget, out object? foundObject)) + if (sourceObject == targetObject) { - // Notify the runtime a reference path was found. - return TrackerObjectManager.AddReferencePath(s_currentRootObjectHandle.Target, foundObject) ? HResults.S_OK : HResults.S_FALSE; + return HResults.S_FALSE; } - return HResults.S_OK; + // Notify the runtime a reference path was found. + return TrackerObjectManager.AddReferencePath(sourceObject, targetObject) ? HResults.S_OK : HResults.S_FALSE; } internal struct ReferenceTargetsVftbl diff --git a/src/coreclr/vm/corelib.h b/src/coreclr/vm/corelib.h index dadbaa73155e60..2a8868ce1a644b 100644 --- a/src/coreclr/vm/corelib.h +++ b/src/coreclr/vm/corelib.h @@ -462,7 +462,8 @@ DEFINE_FIELD(COMWRAPPERS, NAITVE_OBJECT_WRAPPER_TABLE, s_nativeObjectWrapperTabl DEFINE_FIELD(COMWRAPPERS, ALL_MANAGED_OBJECT_WRAPPER_TABLE, s_allManagedObjectWrapperTable) DEFINE_CLASS_U(Interop, ComWrappers+ManagedObjectWrapperHolder, ManagedObjectWrapperHolderObject) -DEFINE_FIELD_U(_wrapper, ManagedObjectWrapperHolderObject, ManagedObjectWrapper) +DEFINE_FIELD_U(_wrappedObject, ManagedObjectWrapperHolderObject, _wrappedObject) +DEFINE_FIELD_U(_wrapper, ManagedObjectWrapperHolderObject, _wrapper) DEFINE_CLASS_U(Interop, ComWrappers+NativeObjectWrapper, NativeObjectWrapperObject) DEFINE_FIELD_U(_comWrappers, NativeObjectWrapperObject, _comWrappers) DEFINE_FIELD_U(_externalComObject, NativeObjectWrapperObject, _externalComObject) diff --git a/src/coreclr/vm/dbginterface.h b/src/coreclr/vm/dbginterface.h index ff8d8580f22c5d..a6b47311fe7e93 100644 --- a/src/coreclr/vm/dbginterface.h +++ b/src/coreclr/vm/dbginterface.h @@ -412,9 +412,6 @@ class DebugInterface virtual HRESULT IsMethodDeoptimized(Module *pModule, mdMethodDef methodDef, BOOL *pResult) = 0; virtual void MulticastTraceNextStep(DELEGATEREF pbDel, INT32 count) = 0; virtual void ExternalMethodFixupNextStep(PCODE address) = 0; -#ifdef FEATURE_SPECIAL_USER_MODE_APC - virtual void SingleStepToExitApcCall(Thread* pThread, CONTEXT *interruptedContext) = 0; -#endif // FEATURE_SPECIAL_USER_MODE_APC #endif //DACCESS_COMPILE }; diff --git a/src/coreclr/vm/interoplibinterface_comwrappers.cpp b/src/coreclr/vm/interoplibinterface_comwrappers.cpp index be582e638cae8c..54bb985229d6a5 100644 --- a/src/coreclr/vm/interoplibinterface_comwrappers.cpp +++ b/src/coreclr/vm/interoplibinterface_comwrappers.cpp @@ -453,16 +453,23 @@ namespace InteropLibImports CONTRACTL_END; // Get the external object's managed wrapper - ::OBJECTHANDLE srcHandle = static_cast<::OBJECTHANDLE>(targetHandle); + ::OBJECTHANDLE srcHandle = static_cast<::OBJECTHANDLE>(sourceHandle); OBJECTREF source = ObjectFromHandle(srcHandle); // Get the target of the external object's reference. ::OBJECTHANDLE tgtHandle = static_cast<::OBJECTHANDLE>(targetHandle); - OBJECTREF target = ObjectFromHandle(tgtHandle ); + MOWHOLDERREF holder = (MOWHOLDERREF)ObjectFromHandle(tgtHandle); - // Return if the target has been collected or these are the same object. - if (target == NULL - || source->PassiveGetSyncBlock() == target->PassiveGetSyncBlock()) + // Return if the holder has been collected + if (holder == NULL) + { + return S_FALSE; + } + + OBJECTREF target = holder->_wrappedObject; + + // Return if these are the same object. + if (source == target) { return S_FALSE; } @@ -496,7 +503,7 @@ bool ComWrappersNative::IsManagedObjectComWrapper(_In_ OBJECTREF managedObjectWr MOWHOLDERREF holder = (MOWHOLDERREF)managedObjectWrapperHolderRef; - *pIsRooted = InteropLib::Com::IsRooted(holder->ManagedObjectWrapper); + *pIsRooted = InteropLib::Com::IsRooted(holder->_wrapper); return true; } diff --git a/src/coreclr/vm/interoplibinterface_comwrappers.h b/src/coreclr/vm/interoplibinterface_comwrappers.h index b7a10f02f66067..763ada50190f1f 100644 --- a/src/coreclr/vm/interoplibinterface_comwrappers.h +++ b/src/coreclr/vm/interoplibinterface_comwrappers.h @@ -73,9 +73,9 @@ class ManagedObjectWrapperHolderObject : public Object friend class ClrDataAccess; private: OBJECTREF _releaser; - OBJECTREF _wrappedObject; public: - DPTR(InteropLib::ABI::ManagedObjectWrapperLayout) ManagedObjectWrapper; + OBJECTREF _wrappedObject; + DPTR(InteropLib::ABI::ManagedObjectWrapperLayout) _wrapper; }; class NativeObjectWrapperObject : public Object diff --git a/src/coreclr/vm/threads.h b/src/coreclr/vm/threads.h index aebee5e6a0739c..1e546ec770cc99 100644 --- a/src/coreclr/vm/threads.h +++ b/src/coreclr/vm/threads.h @@ -482,7 +482,6 @@ class Thread friend void STDCALL OnHijackWorker(HijackArgs * pArgs); #ifdef FEATURE_THREAD_ACTIVATION friend void HandleSuspensionForInterruptedThread(CONTEXT *interruptedContext); - friend void HandleSuspensionForInterruptedThread(CONTEXT *interruptedContext, bool suspendForDebugger); friend BOOL CheckActivationSafePoint(SIZE_T ip); #endif // FEATURE_THREAD_ACTIVATION @@ -550,7 +549,7 @@ class Thread TS_Hijacked = 0x00000080, // Return address has been hijacked #endif // FEATURE_HIJACK - TS_SSToExitApcCall = 0x00000100, // Enable SS and resume the thread to exit an APC Call and keep the thread in suspend state + // unused = 0x00000100, TS_Background = 0x00000200, // Thread is a background thread TS_Unstarted = 0x00000400, // Thread has never been started TS_Dead = 0x00000800, // Thread is dead @@ -567,7 +566,7 @@ class Thread TS_ReportDead = 0x00010000, // in WaitForOtherThreads() TS_FullyInitialized = 0x00020000, // Thread is fully initialized and we are ready to broadcast its existence to external clients - TS_SSToExitApcCallDone = 0x00040000, // The thread exited an APC Call and it is already resumed and paused on SS + // unused = 0x00040000, TS_SyncSuspended = 0x00080000, // Suspended via WaitSuspendEvent TS_DebugWillSync = 0x00100000, // Debugger will wait for this thread to sync @@ -2571,9 +2570,7 @@ class Thread //------------------------------------------------------------- // Waiting & Synchronization //------------------------------------------------------------- -friend class DebuggerController; -protected: - void MarkForSuspensionAndWait(ULONG bit); + // For suspends. The thread waits on this event. A client sets the event to cause // the thread to resume. void WaitSuspendEvents(); diff --git a/src/coreclr/vm/threadsuspend.cpp b/src/coreclr/vm/threadsuspend.cpp index 4e7a0020927076..45a6e45dcd1682 100644 --- a/src/coreclr/vm/threadsuspend.cpp +++ b/src/coreclr/vm/threadsuspend.cpp @@ -4210,18 +4210,6 @@ bool Thread::SysSweepThreadsForDebug(bool forceSync) if ((thread->m_State & TS_DebugWillSync) == 0) continue; -#ifdef FEATURE_SPECIAL_USER_MODE_APC - if (thread->m_State & Thread::TS_SSToExitApcCallDone) - { - thread->ResetThreadState(Thread::TS_SSToExitApcCallDone); - goto Label_MarkThreadAsSynced; - } - if (thread->m_State & Thread::TS_SSToExitApcCall) - { - continue; - } -#endif - if (!UseContextBasedThreadRedirection()) { // On platforms that do not support safe thread suspension we either @@ -5346,19 +5334,6 @@ BOOL Thread::HandledJITCase() #endif // FEATURE_HIJACK // Some simple helpers to keep track of the threads we are waiting for -void Thread::MarkForSuspensionAndWait(ULONG bit) -{ - CONTRACTL { - NOTHROW; - GC_NOTRIGGER; - } - CONTRACTL_END; - m_DebugSuspendEvent.Reset(); - InterlockedOr((LONG*)&m_State, bit); - ThreadStore::IncrementTrapReturningThreads(); - m_DebugSuspendEvent.Wait(INFINITE,FALSE); -} - void Thread::MarkForSuspension(ULONG bit) { CONTRACTL { @@ -5781,8 +5756,7 @@ BOOL CheckActivationSafePoint(SIZE_T ip) // address to take the thread to the appropriate stub (based on the return // type of the method) which will then handle preparing the thread for GC. // - -void HandleSuspensionForInterruptedThread(CONTEXT *interruptedContext, bool suspendForDebugger) +void HandleSuspensionForInterruptedThread(CONTEXT *interruptedContext) { struct AutoClearPendingThreadActivation { @@ -5818,18 +5792,6 @@ void HandleSuspensionForInterruptedThread(CONTEXT *interruptedContext, bool susp if (!codeInfo.IsValid()) return; -#ifdef FEATURE_SPECIAL_USER_MODE_APC - // It's not allowed to change the IP while paused in an APC Callback for security reasons if CET is turned on - // So we enable the single step in the thread that is running the APC Callback - // and then it will be paused using single step exception after exiting the APC callback - // this will allow the debugger to setIp to execute FuncEvalHijack. - if (suspendForDebugger) - { - g_pDebugInterface->SingleStepToExitApcCall(pThread, interruptedContext); - return; - } -#endif - DWORD addrOffset = codeInfo.GetRelOffset(); ICodeManager *pEECM = codeInfo.GetCodeManager(); @@ -5905,11 +5867,6 @@ void HandleSuspensionForInterruptedThread(CONTEXT *interruptedContext, bool susp } } -void HandleSuspensionForInterruptedThread(CONTEXT *interruptedContext) -{ - HandleSuspensionForInterruptedThread(interruptedContext, false); -} - #ifdef FEATURE_SPECIAL_USER_MODE_APC void Thread::ApcActivationCallback(ULONG_PTR Parameter) { @@ -5936,10 +5893,10 @@ void Thread::ApcActivationCallback(ULONG_PTR Parameter) switch (reason) { - case ActivationReason::SuspendForDebugger: case ActivationReason::SuspendForGC: + case ActivationReason::SuspendForDebugger: case ActivationReason::ThreadAbort: - HandleSuspensionForInterruptedThread(pContext, reason == ActivationReason::SuspendForDebugger); + HandleSuspensionForInterruptedThread(pContext); break; default: