From 73e25ad7b4ad073c47a826fafca7a246ec3d940a Mon Sep 17 00:00:00 2001 From: David Barbet Date: Thu, 26 May 2022 10:47:40 -0700 Subject: [PATCH 01/38] Don't throw in logging when the document path contains curly braces (#61524) --- .../Core/Def/LanguageClient/LogHubLspLogger.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/VisualStudio/Core/Def/LanguageClient/LogHubLspLogger.cs b/src/VisualStudio/Core/Def/LanguageClient/LogHubLspLogger.cs index 23852a3ee91d8..d35664d71111e 100644 --- a/src/VisualStudio/Core/Def/LanguageClient/LogHubLspLogger.cs +++ b/src/VisualStudio/Core/Def/LanguageClient/LogHubLspLogger.cs @@ -37,7 +37,13 @@ public void Dispose() } public void TraceInformation(string message) - => _traceSource.TraceInformation(message); + { + // Explicitly call TraceEvent here instead of TraceInformation. + // TraceInformation indirectly calls string.Format which throws if the message + // has unescaped curlies in it (can be a part of a URI for example). + // Since we have no need to call string.Format here, we don't. + _traceSource.TraceEvent(TraceEventType.Information, id: 0, message); + } public void TraceWarning(string message) => _traceSource.TraceEvent(TraceEventType.Warning, id: 0, message); From e4811a350587bc78851f63364dedd5b7717856fb Mon Sep 17 00:00:00 2001 From: Shen Chen Date: Wed, 11 Jan 2023 20:36:42 +0000 Subject: [PATCH 02/38] Merged PR 28791: Update VS telemetry version from 16.4.56 to 16.4.67 MSRC fix for 17.2. I create a feature branch for the fix to check from release/dev17.2 According to the table in the email, We should update to 16.4.67 ![image.png](https://dev.azure.com/dnceng/7ea9116e-9fac-403d-b258-b31fcf1bb293/_apis/git/repositories/7b863b8d-8cc3-431d-b06b-7136cc32bbe6/pullRequests/28791/attachments/image.png) Verification locally: ![image (2).png](https://dev.azure.com/dnceng/7ea9116e-9fac-403d-b258-b31fcf1bb293/_apis/git/repositories/7b863b8d-8cc3-431d-b06b-7136cc32bbe6/pullRequests/28791/attachments/image%20%282%29.png) From the kusto: ![image (3).png](https://dev.azure.com/dnceng/7ea9116e-9fac-403d-b258-b31fcf1bb293/_apis/git/repositories/7b863b8d-8cc3-431d-b06b-7136cc32bbe6/pullRequests/28791/attachments/image%20%283%29.png) --- NuGet.config | 5 +++++ eng/Versions.props | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NuGet.config b/NuGet.config index a26b4ca869d72..ab0f683bd87af 100644 --- a/NuGet.config +++ b/NuGet.config @@ -15,6 +15,11 @@ + + + + + diff --git a/eng/Versions.props b/eng/Versions.props index 4f84bfcc577a6..4a6f2ffaba19b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -171,7 +171,7 @@ $(MicrosoftVisualStudioShellPackagesVersion) $(MicrosoftVisualStudioShellPackagesVersion) $(MicrosoftVisualStudioShellPackagesVersion) - 16.4.56 + 16.4.67 8.0.0.0-alpha $(VisualStudioEditorPackagesVersion) $(VisualStudioEditorPackagesVersion) From 3e27709e84f99c4a144923b450dc5a2034056f24 Mon Sep 17 00:00:00 2001 From: Shen Chen Date: Tue, 17 Jan 2023 18:34:07 +0000 Subject: [PATCH 03/38] Merged PR 28885: Remove the unused feed since the package is public The package becomes public accidentally so we don't need to add the nuget feeds --- NuGet.config | 5 ----- 1 file changed, 5 deletions(-) diff --git a/NuGet.config b/NuGet.config index ab0f683bd87af..a26b4ca869d72 100644 --- a/NuGet.config +++ b/NuGet.config @@ -15,11 +15,6 @@ - - - - - From 82a12de507380de26e62d594b44a60ca747aa0c7 Mon Sep 17 00:00:00 2001 From: Shen Chen Date: Tue, 31 Jan 2023 19:00:13 +0000 Subject: [PATCH 04/38] Merged PR 29274: Update VS telemetry version Update VS telemetry version according to the table for the MSRC ![image.png](https://dev.azure.com/dnceng/7ea9116e-9fac-403d-b258-b31fcf1bb293/_apis/git/repositories/7b863b8d-8cc3-431d-b06b-7136cc32bbe6/pullRequests/29274/attachments/image.png) Would do the validation work in the insertion PR --- NuGet.config | 2 ++ eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NuGet.config b/NuGet.config index 513b93df1e591..aeceaf3a65ee5 100644 --- a/NuGet.config +++ b/NuGet.config @@ -13,6 +13,8 @@ + + diff --git a/eng/Versions.props b/eng/Versions.props index f97c3f9ed0982..a237d2b9f65bf 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -170,7 +170,7 @@ $(MicrosoftVisualStudioShellPackagesVersion) $(MicrosoftVisualStudioShellPackagesVersion) $(MicrosoftVisualStudioShellPackagesVersion) - 16.3.600 + 16.3.613 8.0.0.0-alpha $(VisualStudioEditorNewPackagesVersion) $(VisualStudioEditorNewPackagesVersion) From eb2fce99b60b9f097e5902e274b81de522ab19b0 Mon Sep 17 00:00:00 2001 From: Andrew Hall Date: Thu, 30 Mar 2023 21:29:52 -0700 Subject: [PATCH 05/38] Add archived feeds (#67430) --- NuGet.config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NuGet.config b/NuGet.config index 3cd2f6f4e6a03..75854b34c9de1 100644 --- a/NuGet.config +++ b/NuGet.config @@ -9,7 +9,9 @@ + + From ee6b2ad1d144c71d6f85cd1cc16ffdedda4ebe4f Mon Sep 17 00:00:00 2001 From: David Barbet Date: Tue, 18 Apr 2023 11:36:21 -0700 Subject: [PATCH 06/38] Use newer version of ubuntu to fix build --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6da3cd93e18bb..4d4fccd9c4347 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -109,7 +109,7 @@ jobs: jobName: Build_Unix_Debug testArtifactName: Transport_Artifacts_Unix_Debug configuration: Debug - vmImageName: 'ubuntu-18.04' + vmImageName: 'ubuntu-20.04' - template: eng/pipelines/test-unix-job.yml parameters: From 0856b769476465fb6791217ff3ef4a42ae2f36c0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 19 Apr 2023 19:07:39 +0000 Subject: [PATCH 07/38] Update dependencies from https://github.com/dotnet/arcade build 20230411.2 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.22524.5 -> To Version 7.0.0-beta.23211.2 --- eng/Version.Details.xml | 8 +-- eng/common/build.ps1 | 2 +- eng/common/cross/arm/tizen-fetch.sh | 6 +-- eng/common/cross/arm64/tizen-fetch.sh | 8 +-- eng/common/cross/armel/tizen-fetch.sh | 8 +-- eng/common/cross/armel/tizen/tizen-dotnet.ks | 50 ++++++++++++++++++ eng/common/cross/build-android-rootfs.sh | 4 +- eng/common/cross/build-rootfs.sh | 7 ++- eng/common/cross/toolchain.cmake | 7 +++ eng/common/cross/x86/tizen-fetch.sh | 6 +-- eng/common/generate-locproject.ps1 | 46 +++++++++++++++- eng/common/loc/P22DotNetHtmlLocalization.lss | Bin 0 -> 3810 bytes eng/common/native/init-compiler.sh | 2 +- eng/common/sdk-task.ps1 | 2 +- eng/common/sdl/NuGet.config | 5 -- eng/common/sdl/sdl.ps1 | 1 - eng/common/templates/job/execute-sdl.yml | 6 +-- eng/common/templates/job/job.yml | 41 ++++++++++++-- eng/common/templates/job/onelocbuild.yml | 14 ++--- .../templates/job/publish-build-assets.yml | 1 + eng/common/templates/job/source-build.yml | 16 ++---- eng/common/templates/jobs/source-build.yml | 2 +- .../templates/post-build/post-build.yml | 2 +- eng/common/templates/steps/execute-sdl.yml | 6 +-- eng/common/templates/steps/generate-sbom.yml | 4 -- eng/common/templates/steps/source-build.yml | 8 +-- .../templates/variables/pool-providers.yml | 49 ++++++++++------- eng/common/tools.ps1 | 4 +- eng/common/tools.sh | 24 +++------ global.json | 8 +-- 30 files changed, 225 insertions(+), 122 deletions(-) create mode 100644 eng/common/cross/armel/tizen/tizen-dotnet.ks create mode 100644 eng/common/loc/P22DotNetHtmlLocalization.lss diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0cf9362e41a48..f4ab434f034a9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -13,18 +13,18 @@ - + https://github.com/dotnet/arcade - c5dd6a1da2e6d9b3423ab809fcda8af2927a408b + 7c5e5a782c67460b123c8e41d484ebcca8002c93 https://github.com/dotnet/roslyn c1d8c6f043bc80425c6828455eb57f8a404759c6 - + https://github.com/dotnet/arcade - c5dd6a1da2e6d9b3423ab809fcda8af2927a408b + 7c5e5a782c67460b123c8e41d484ebcca8002c93 diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 33a6f2d0e2481..e0420a6427550 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -67,8 +67,8 @@ function Print-Usage() { Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build" Write-Host " -warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)." - Write-Host " -excludePrereleaseVS Set to exclude build engines in prerelease versions of Visual Studio" Write-Host " -nativeToolsOnMachine Sets the native tools on machine environment variable (indicating that the script should use native tools on machine)" + Write-Host " -excludePrereleaseVS Set to exclude build engines in prerelease versions of Visual Studio" Write-Host "" Write-Host "Command line arguments not listed above are passed thru to msbuild." diff --git a/eng/common/cross/arm/tizen-fetch.sh b/eng/common/cross/arm/tizen-fetch.sh index 0adb0f11ec329..eabd06c4afede 100644 --- a/eng/common/cross/arm/tizen-fetch.sh +++ b/eng/common/cross/arm/tizen-fetch.sh @@ -51,7 +51,7 @@ if [ ! -d $TMPDIR ]; then mkdir -p $TMPDIR fi -TIZEN_URL=http://download.tizen.org/snapshots/TIZEN/Tizen +TIZEN_URL=http://download.tizen.org/snapshots/tizen BUILD_XML=build.xml REPOMD_XML=repomd.xml PRIMARY_XML=primary.xml @@ -155,7 +155,7 @@ fetch_tizen_pkgs() } Inform "Initialize arm base" -fetch_tizen_pkgs_init standard Tizen-Base +fetch_tizen_pkgs_init standard base Inform "fetch common packages" fetch_tizen_pkgs armv7hl gcc gcc-devel-static glibc glibc-devel libicu libicu-devel libatomic linux-glibc-devel keyutils keyutils-devel libkeyutils Inform "fetch coreclr packages" @@ -164,7 +164,7 @@ Inform "fetch corefx packages" fetch_tizen_pkgs armv7hl libcom_err libcom_err-devel zlib zlib-devel libopenssl11 libopenssl1.1-devel krb5 krb5-devel Inform "Initialize standard unified" -fetch_tizen_pkgs_init standard Tizen-Unified +fetch_tizen_pkgs_init standard unified Inform "fetch corefx packages" fetch_tizen_pkgs armv7hl gssdp gssdp-devel tizen-release diff --git a/eng/common/cross/arm64/tizen-fetch.sh b/eng/common/cross/arm64/tizen-fetch.sh index 785bd85484e25..16d1301f21e4c 100644 --- a/eng/common/cross/arm64/tizen-fetch.sh +++ b/eng/common/cross/arm64/tizen-fetch.sh @@ -51,7 +51,7 @@ if [ ! -d $TMPDIR ]; then mkdir -p $TMPDIR fi -TIZEN_URL=http://download.tizen.org/snapshots/TIZEN/Tizen +TIZEN_URL=http://download.tizen.org/snapshots/tizen/ BUILD_XML=build.xml REPOMD_XML=repomd.xml PRIMARY_XML=primary.xml @@ -154,8 +154,8 @@ fetch_tizen_pkgs() done } -Inform "Initialize arm64 base" -fetch_tizen_pkgs_init standard Tizen-Base +Inform "Initialize arm base" +fetch_tizen_pkgs_init standard base Inform "fetch common packages" fetch_tizen_pkgs aarch64 gcc glibc glibc-devel libicu libicu-devel libatomic linux-glibc-devel keyutils keyutils-devel libkeyutils Inform "fetch coreclr packages" @@ -164,7 +164,7 @@ Inform "fetch corefx packages" fetch_tizen_pkgs aarch64 libcom_err libcom_err-devel zlib zlib-devel libopenssl11 libopenssl1.1-devel krb5 krb5-devel Inform "Initialize standard unified" -fetch_tizen_pkgs_init standard Tizen-Unified +fetch_tizen_pkgs_init standard unified Inform "fetch corefx packages" fetch_tizen_pkgs aarch64 gssdp gssdp-devel tizen-release diff --git a/eng/common/cross/armel/tizen-fetch.sh b/eng/common/cross/armel/tizen-fetch.sh index 3d8f177a34444..64f0187e5aaa2 100755 --- a/eng/common/cross/armel/tizen-fetch.sh +++ b/eng/common/cross/armel/tizen-fetch.sh @@ -51,7 +51,7 @@ if [ ! -d $TMPDIR ]; then mkdir -p $TMPDIR fi -TIZEN_URL=http://download.tizen.org/snapshots/TIZEN/Tizen +TIZEN_URL=http://download.tizen.org/snapshots/tizen BUILD_XML=build.xml REPOMD_XML=repomd.xml PRIMARY_XML=primary.xml @@ -154,8 +154,8 @@ fetch_tizen_pkgs() done } -Inform "Initialize armel base" -fetch_tizen_pkgs_init standard Tizen-Base +Inform "Initialize arm base" +fetch_tizen_pkgs_init standard base Inform "fetch common packages" fetch_tizen_pkgs armv7l gcc gcc-devel-static glibc glibc-devel libicu libicu-devel libatomic linux-glibc-devel keyutils keyutils-devel libkeyutils Inform "fetch coreclr packages" @@ -164,7 +164,7 @@ Inform "fetch corefx packages" fetch_tizen_pkgs armv7l libcom_err libcom_err-devel zlib zlib-devel libopenssl11 libopenssl1.1-devel krb5 krb5-devel Inform "Initialize standard unified" -fetch_tizen_pkgs_init standard Tizen-Unified +fetch_tizen_pkgs_init standard unified Inform "fetch corefx packages" fetch_tizen_pkgs armv7l gssdp gssdp-devel tizen-release diff --git a/eng/common/cross/armel/tizen/tizen-dotnet.ks b/eng/common/cross/armel/tizen/tizen-dotnet.ks new file mode 100644 index 0000000000000..506d455bd4ff8 --- /dev/null +++ b/eng/common/cross/armel/tizen/tizen-dotnet.ks @@ -0,0 +1,50 @@ +lang en_US.UTF-8 +keyboard us +timezone --utc Asia/Seoul + +part / --fstype="ext4" --size=3500 --ondisk=mmcblk0 --label rootfs --fsoptions=defaults,noatime + +rootpw tizen +desktop --autologinuser=root +user --name root --groups audio,video --password 'tizen' + +repo --name=standard --baseurl=http://download.tizen.org/releases/milestone/tizen/unified/latest/repos/standard/packages/ --ssl_verify=no +repo --name=base --baseurl=http://download.tizen.org/releases/milestone/tizen/base/latest/repos/standard/packages/ --ssl_verify=no + +%packages +tar +gzip + +sed +grep +gawk +perl + +binutils +findutils +util-linux +lttng-ust +userspace-rcu +procps-ng +tzdata +ca-certificates + + +### Core FX +libicu +libunwind +iputils +zlib +krb5 +libcurl +libopenssl + +%end + +%post + +### Update /tmp privilege +chmod 777 /tmp +#################################### + +%end diff --git a/eng/common/cross/build-android-rootfs.sh b/eng/common/cross/build-android-rootfs.sh index f163fb9dae966..42516bbeebc3f 100755 --- a/eng/common/cross/build-android-rootfs.sh +++ b/eng/common/cross/build-android-rootfs.sh @@ -107,12 +107,12 @@ __AndroidPackages+=" liblzma" __AndroidPackages+=" krb5" __AndroidPackages+=" openssl" -for path in $(wget -qO- https://packages.termux.dev/termux-main-21/dists/stable/main/binary-$__AndroidArch/Packages |\ +for path in $(wget -qO- http://termux.net/dists/stable/main/binary-$__AndroidArch/Packages |\ grep -A15 "Package: \(${__AndroidPackages// /\\|}\)" | grep -v "static\|tool" | grep Filename); do if [[ "$path" != "Filename:" ]]; then echo "Working on: $path" - wget -qO- https://packages.termux.dev/termux-main-21/$path | dpkg -x - "$__TmpDir" + wget -qO- http://termux.net/$path | dpkg -x - "$__TmpDir" fi done diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index eddb4c380af01..5680980fa296e 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -391,9 +391,9 @@ elif [[ "$__CodeName" == "illumos" ]]; then --with-gnu-ld --disable-nls --disable-libgomp --disable-libquadmath --disable-libssp --disable-libvtv --disable-libcilkrts --disable-libada --disable-libsanitizer \ --disable-libquadmath-support --disable-shared --enable-tls make -j "$JOBS" && make install && cd .. - BaseUrl=https://pkgsrc.smartos.org + BaseUrl=https://pkgsrc.joyent.com if [[ "$__UseMirror" == 1 ]]; then - BaseUrl=https://pkgsrc.smartos.skylime.net + BaseUrl=http://pkgsrc.smartos.skylime.net fi BaseUrl="$BaseUrl/packages/SmartOS/trunk/${__illumosArch}/All" echo "Downloading manifest" @@ -402,8 +402,7 @@ elif [[ "$__CodeName" == "illumos" ]]; then read -ra array <<<"$__IllumosPackages" for package in "${array[@]}"; do echo "Installing '$package'" - # find last occurrence of package in listing and extract its name - package="$(sed -En '/.*href="('"$package"'-[0-9].*).tgz".*/h;$!d;g;s//\1/p' All)" + package="$(grep ">$package-[0-9]" All | sed -En 's/.*href="(.*)\.tgz".*/\1/p')" echo "Resolved name '$package'" wget "$BaseUrl"/"$package".tgz ar -x "$package".tgz diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake index 561576be97c26..964610524760a 100644 --- a/eng/common/cross/toolchain.cmake +++ b/eng/common/cross/toolchain.cmake @@ -1,5 +1,12 @@ set(CROSS_ROOTFS $ENV{ROOTFS_DIR}) +# reset platform variables (e.g. cmake 3.25 sets LINUX=1) +unset(LINUX) +unset(FREEBSD) +unset(ILLUMOS) +unset(ANDROID) +unset(TIZEN) + set(TARGET_ARCH_NAME $ENV{TARGET_BUILD_ARCH}) if(EXISTS ${CROSS_ROOTFS}/bin/freebsd-version) set(CMAKE_SYSTEM_NAME FreeBSD) diff --git a/eng/common/cross/x86/tizen-fetch.sh b/eng/common/cross/x86/tizen-fetch.sh index cf8d1ce4a8e55..fa5f88b7d6c0d 100644 --- a/eng/common/cross/x86/tizen-fetch.sh +++ b/eng/common/cross/x86/tizen-fetch.sh @@ -51,7 +51,7 @@ if [ ! -d $TMPDIR ]; then mkdir -p $TMPDIR fi -TIZEN_URL=http://download.tizen.org/snapshots/TIZEN/Tizen +TIZEN_URL=http://download.tizen.org/snapshots/tizen BUILD_XML=build.xml REPOMD_XML=repomd.xml PRIMARY_XML=primary.xml @@ -155,7 +155,7 @@ fetch_tizen_pkgs() } Inform "Initialize i686 base" -fetch_tizen_pkgs_init standard Tizen-Base +fetch_tizen_pkgs_init standard base Inform "fetch common packages" fetch_tizen_pkgs i686 gcc gcc-devel-static glibc glibc-devel libicu libicu-devel libatomic linux-glibc-devel keyutils keyutils-devel libkeyutils Inform "fetch coreclr packages" @@ -164,7 +164,7 @@ Inform "fetch corefx packages" fetch_tizen_pkgs i686 libcom_err libcom_err-devel zlib zlib-devel libopenssl11 libopenssl1.1-devel krb5 krb5-devel Inform "Initialize standard unified" -fetch_tizen_pkgs_init standard Tizen-Unified +fetch_tizen_pkgs_init standard unified Inform "fetch corefx packages" fetch_tizen_pkgs i686 gssdp gssdp-devel tizen-release diff --git a/eng/common/generate-locproject.ps1 b/eng/common/generate-locproject.ps1 index dbf2ab4ee7d17..bcb579e37a91b 100644 --- a/eng/common/generate-locproject.ps1 +++ b/eng/common/generate-locproject.ps1 @@ -34,6 +34,25 @@ $jsonTemplateFiles | ForEach-Object { $jsonWinformsTemplateFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "en\\strings\.json" } # current winforms pattern $wxlFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "\\.+\.wxl" -And -Not( $_.Directory.Name -Match "\d{4}" ) } # localized files live in four digit lang ID directories; this excludes them +if (-not $wxlFiles) { + $wxlEnFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "\\1033\\.+\.wxl" } # pick up en files (1033 = en) specifically so we can copy them to use as the neutral xlf files + if ($wxlEnFiles) { + $wxlFiles = @() + $wxlEnFiles | ForEach-Object { + $destinationFile = "$($_.Directory.Parent.FullName)\$($_.Name)" + $wxlFiles += Copy-Item "$($_.FullName)" -Destination $destinationFile -PassThru + } + } +} + +$macosHtmlEnFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "en\.lproj\\.+\.html" } # add installer HTML files +$macosHtmlFiles = @() +if ($macosHtmlEnFiles) { + $macosHtmlEnFiles | ForEach-Object { + $destinationFile = "$($_.Directory.Parent.FullName)\$($_.Name)" + $macosHtmlFiles += Copy-Item "$($_.FullName)" -Destination $destinationFile -PassThru + } +} $xlfFiles = @() @@ -99,8 +118,7 @@ $locJson = @{ $outputPath = "$($_.Directory.FullName | Resolve-Path -Relative)\" $continue = $true foreach ($exclusion in $exclusions.Exclusions) { - if ($_.FullName.Contains($exclusion)) - { + if ($_.FullName.Contains($exclusion)) { $continue = $false } } @@ -115,6 +133,30 @@ $locJson = @{ } } ) + }, + @{ + LanguageSet = $LanguageSet + CloneLanguageSet = "VS_macOS_CloneLanguages" + LssFiles = @( ".\eng\common\loc\P22DotNetHtmlLocalization.lss" ) + LocItems = @( + $macosHtmlFiles | ForEach-Object { + $outputPath = "$($_.Directory.FullName | Resolve-Path -Relative)\" + $continue = $true + foreach ($exclusion in $exclusions.Exclusions) { + if ($_.FullName.Contains($exclusion)) { + $continue = $false + } + } + $sourceFile = ($_.FullName | Resolve-Path -Relative) + if ($continue) { + return @{ + SourceFile = $sourceFile + CopyOption = "LangIDOnPath" + OutputPath = $outputPath + } + } + } + ) } ) } diff --git a/eng/common/loc/P22DotNetHtmlLocalization.lss b/eng/common/loc/P22DotNetHtmlLocalization.lss new file mode 100644 index 0000000000000000000000000000000000000000..6661fed566e49b0c206665bc21f135e06c9b89c4 GIT binary patch literal 3810 zcmd^CT~8BH5S?ce|HG9Bo&v?0;P_m6l= znU-wb=}VLT7UH{>{5H;0M4iLmRE8QeBRr|>&k=uV*L;heKY+dq>B$0^=0I}|x`)s{ zht4t9zaiEh5Fe>E-;zVT;c4G?v;9N0G=rWwo~*(Cs`OS6ZL`HL;vsL0J@I%$+0YvE zx{9ukK|FtFx1PlPD5M;6ZM>f;1BhCf?`8y6QH*?RT9T>XwF z#~m_N+i^UKE^j{e;KdNW`kH9Rbj{G8tDY}mafCgG+m3H`I@_PhrDmcIzxD&IX@s083kV|lLUE^0(h6wWRPN0QN1n^PU5eX8r6OZ*s^g)tt77#SZCB}znxye#U$Dtinr6lnVu z!LzA{A}0~no7p$thFGJAnI}oSW||9H=Bz}I7kD#2MLg7WfrlE5o9sQjePc>qmv+6iQCmdp(y}(Vr literal 0 HcmV?d00001 diff --git a/eng/common/native/init-compiler.sh b/eng/common/native/init-compiler.sh index 41a26d802a93f..f13b74080edf9 100644 --- a/eng/common/native/init-compiler.sh +++ b/eng/common/native/init-compiler.sh @@ -71,7 +71,7 @@ if [[ -z "$CLR_CC" ]]; then # Set default versions if [[ -z "$majorVersion" ]]; then # note: gcc (all versions) and clang versions higher than 6 do not have minor version in file name, if it is zero. - if [[ "$compiler" == "clang" ]]; then versions=( 15 14 13 12 11 10 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 ) + if [[ "$compiler" == "clang" ]]; then versions=( 16 15 14 13 12 11 10 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 ) elif [[ "$compiler" == "gcc" ]]; then versions=( 12 11 10 9 8 7 6 5 4.9 ); fi for version in "${versions[@]}"; do diff --git a/eng/common/sdk-task.ps1 b/eng/common/sdk-task.ps1 index c35087a06019e..e10a596879746 100644 --- a/eng/common/sdk-task.ps1 +++ b/eng/common/sdk-task.ps1 @@ -64,7 +64,7 @@ try { $GlobalJson.tools | Add-Member -Name "vs" -Value (ConvertFrom-Json "{ `"version`": `"16.5`" }") -MemberType NoteProperty } if( -not ($GlobalJson.tools.PSObject.Properties.Name -match "xcopy-msbuild" )) { - $GlobalJson.tools | Add-Member -Name "xcopy-msbuild" -Value "17.2.1" -MemberType NoteProperty + $GlobalJson.tools | Add-Member -Name "xcopy-msbuild" -Value "17.4.1" -MemberType NoteProperty } if ($GlobalJson.tools."xcopy-msbuild".Trim() -ine "none") { $xcopyMSBuildToolsFolder = InitializeXCopyMSBuild $GlobalJson.tools."xcopy-msbuild" -install $true diff --git a/eng/common/sdl/NuGet.config b/eng/common/sdl/NuGet.config index 3849bdb3cf51e..0c5451c11415f 100644 --- a/eng/common/sdl/NuGet.config +++ b/eng/common/sdl/NuGet.config @@ -7,11 +7,6 @@ - - - - - diff --git a/eng/common/sdl/sdl.ps1 b/eng/common/sdl/sdl.ps1 index 648c5068d7d60..ac196e164a401 100644 --- a/eng/common/sdl/sdl.ps1 +++ b/eng/common/sdl/sdl.ps1 @@ -1,7 +1,6 @@ function Install-Gdn { param( - [Parameter(Mandatory=$true)] [string]$Path, # If omitted, install the latest version of Guardian, otherwise install that specific version. diff --git a/eng/common/templates/job/execute-sdl.yml b/eng/common/templates/job/execute-sdl.yml index 7aabaa18017bf..7c164ac02f4da 100644 --- a/eng/common/templates/job/execute-sdl.yml +++ b/eng/common/templates/job/execute-sdl.yml @@ -34,7 +34,7 @@ jobs: - job: Run_SDL dependsOn: ${{ parameters.dependsOn }} displayName: Run SDL tool - condition: and(succeededOrFailed(), eq( ${{ parameters.enable }}, 'true')) + condition: eq( ${{ parameters.enable }}, 'true') variables: - group: DotNet-VSTS-Bot - name: AzDOProjectName @@ -60,9 +60,7 @@ jobs: - checkout: self clean: true - # If the template caller didn't provide an AzDO parameter, set them all up as Maestro vars. - - ${{ if not(and(parameters.AzDOProjectName, parameters.AzDOPipelineId, parameters.AzDOBuildId)) }}: - - template: /eng/common/templates/post-build/setup-maestro-vars.yml + - template: /eng/common/templates/post-build/setup-maestro-vars.yml - ${{ if ne(parameters.downloadArtifacts, 'false')}}: - ${{ if ne(parameters.artifactNames, '') }}: diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 9f55d3f466600..e3ba9398016be 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -25,7 +25,6 @@ parameters: enablePublishTestResults: false enablePublishUsingPipelines: false disableComponentGovernance: false - componentGovernanceIgnoreDirectories: '' mergeTestResults: false testRunTitle: '' testResultsFormat: '' @@ -141,14 +140,11 @@ jobs: languages: ${{ coalesce(parameters.richCodeNavigationLanguage, 'csharp') }} environment: ${{ coalesce(parameters.richCodeNavigationEnvironment, 'production') }} richNavLogOutputDirectory: $(Build.SourcesDirectory)/artifacts/bin - uploadRichNavArtifacts: ${{ coalesce(parameters.richCodeNavigationUploadArtifacts, false) }} continueOnError: true - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), ne(parameters.disableComponentGovernance, 'true')) }}: - task: ComponentGovernanceComponentDetection@0 continueOnError: true - inputs: - ignoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: @@ -187,6 +183,24 @@ jobs: displayName: Publish logs continueOnError: true condition: always() + - ${{ if or(eq(parameters.artifacts.publish.manifests, 'true'), ne(parameters.artifacts.publish.manifests, '')) }}: + - ${{ if and(ne(parameters.enablePublishUsingPipelines, 'true'), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: CopyFiles@2 + displayName: Gather Asset Manifests + inputs: + SourceFolder: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/AssetManifest' + TargetFolder: '$(Build.ArtifactStagingDirectory)/AssetManifests' + continueOnError: ${{ parameters.continueOnError }} + condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) + + - task: PublishBuildArtifacts@1 + displayName: Push Asset Manifests + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)/AssetManifests' + PublishLocation: Container + ArtifactName: AssetManifests + continueOnError: ${{ parameters.continueOnError }} + condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) - ${{ if ne(parameters.enablePublishBuildArtifacts, 'false') }}: - task: PublishBuildArtifacts@1 @@ -220,11 +234,28 @@ jobs: mergeTestResults: ${{ parameters.mergeTestResults }} continueOnError: true condition: always() + + - ${{ if and(eq(parameters.enablePublishBuildAssets, true), ne(parameters.enablePublishUsingPipelines, 'true'), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: CopyFiles@2 + displayName: Gather Asset Manifests + inputs: + SourceFolder: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/AssetManifest' + TargetFolder: '$(Build.StagingDirectory)/AssetManifests' + continueOnError: ${{ parameters.continueOnError }} + condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) + + - task: PublishBuildArtifacts@1 + displayName: Push Asset Manifests + inputs: + PathtoPublish: '$(Build.StagingDirectory)/AssetManifests' + PublishLocation: Container + ArtifactName: AssetManifests + continueOnError: ${{ parameters.continueOnError }} + condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}: - template: /eng/common/templates/steps/generate-sbom.yml parameters: PackageVersion: ${{ parameters.packageVersion}} BuildDropPath: ${{ parameters.buildDropPath }} - IgnoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} diff --git a/eng/common/templates/job/onelocbuild.yml b/eng/common/templates/job/onelocbuild.yml index c2cabcf9e0686..60ab00c4de3ac 100644 --- a/eng/common/templates/job/onelocbuild.yml +++ b/eng/common/templates/job/onelocbuild.yml @@ -14,6 +14,7 @@ parameters: ReusePr: true UseLfLineEndings: true UseCheckedInLocProjectJson: false + SkipLocProjectJsonGeneration: false LanguageSet: VS_Main_Languages LclSource: lclFilesInRepo LclPackageId: '' @@ -56,12 +57,13 @@ jobs: demands: ImageOverride -equals windows.vs2019.amd64 steps: - - task: Powershell@2 - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/generate-locproject.ps1 - arguments: $(_GenerateLocProjectArguments) - displayName: Generate LocProject.json - condition: ${{ parameters.condition }} + - ${{ if ne(parameters.SkipLocProjectJsonGeneration, 'true') }}: + - task: Powershell@2 + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/generate-locproject.ps1 + arguments: $(_GenerateLocProjectArguments) + displayName: Generate LocProject.json + condition: ${{ parameters.condition }} - task: OneLocBuild@2 displayName: OneLocBuild diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml index 1f1b78f2d4598..c5fedd7f70ce6 100644 --- a/eng/common/templates/job/publish-build-assets.yml +++ b/eng/common/templates/job/publish-build-assets.yml @@ -34,6 +34,7 @@ jobs: - job: Asset_Registry_Publish dependsOn: ${{ parameters.dependsOn }} + timeoutInMinutes: 150 ${{ if eq(parameters.publishAssetsImmediately, 'true') }}: displayName: Publish Assets diff --git a/eng/common/templates/job/source-build.yml b/eng/common/templates/job/source-build.yml index e40bf35203b9e..8a3deef2b7274 100644 --- a/eng/common/templates/job/source-build.yml +++ b/eng/common/templates/job/source-build.yml @@ -46,20 +46,12 @@ jobs: # source-build builds run in Docker, including the default managed platform. # /eng/common/templates/variables/pool-providers.yml can't be used here (some customers declare variables already), so duplicate its logic pool: - # Main environments - ${{ if and(eq(variables['System.TeamProject'], 'public'), ne(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), true)) }}: - name: NetCore-Public + ${{ if eq(variables['System.TeamProject'], 'public') }}: + name: $[replace(replace(eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), True, 'NetCore-Svc-Public' ), False, 'NetCore-Public')] demands: ImageOverride -equals Build.Ubuntu.1804.Amd64.Open - ${{ if and(eq(variables['System.TeamProject'], 'internal'), ne(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), true)) }}: - name: NetCore1ESPool-Internal - demands: ImageOverride -equals Build.Ubuntu.1804.Amd64 - # Servicing build environments - ${{ if and(eq(variables['System.TeamProject'], 'public'), contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release')) }}: - name: NetCore-Svc-Public - demands: ImageOverride -equals Build.Ubuntu.1804.Amd64.Open - ${{ if and(eq(variables['System.TeamProject'], 'internal'), contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release')) }}: - name: NetCore1ESPool-Svc-Internal + ${{ if eq(variables['System.TeamProject'], 'internal') }}: + name: $[replace(replace(eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), True, 'NetCore1ESPool-Svc-Internal'), False, 'NetCore1ESPool-Internal')] demands: ImageOverride -equals Build.Ubuntu.1804.Amd64 ${{ if ne(parameters.platform.pool, '') }}: diff --git a/eng/common/templates/jobs/source-build.yml b/eng/common/templates/jobs/source-build.yml index a15b07eb51d9d..8dd2d355f22d2 100644 --- a/eng/common/templates/jobs/source-build.yml +++ b/eng/common/templates/jobs/source-build.yml @@ -14,7 +14,7 @@ parameters: # This is the default platform provided by Arcade, intended for use by a managed-only repo. defaultManagedPlatform: name: 'Managed' - container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8' + container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8-20220809204800-17a4aab' # Defines the platforms on which to run build jobs. One job is created for each platform, and the # object in this array is sent to the job template as 'platform'. If no platforms are specified, diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 91251d08973c6..c051f1b65e9cd 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -99,7 +99,7 @@ stages: jobs: - job: displayName: NuGet Validation - condition: and(succeededOrFailed(), eq( ${{ parameters.enableNugetValidation }}, 'true')) + condition: eq( ${{ parameters.enableNugetValidation }}, 'true') pool: # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: diff --git a/eng/common/templates/steps/execute-sdl.yml b/eng/common/templates/steps/execute-sdl.yml index 9dd5709f66dc7..86cf578c43144 100644 --- a/eng/common/templates/steps/execute-sdl.yml +++ b/eng/common/templates/steps/execute-sdl.yml @@ -17,16 +17,14 @@ steps: - ${{ if ne(parameters.overrideGuardianVersion, '') }}: - pwsh: | - Set-Location -Path $(Build.SourcesDirectory)\eng\common\sdl - . .\sdl.ps1 + . $(Build.SourcesDirectory)\eng\common\sdl\sdl.ps1 $guardianCliLocation = Install-Gdn -Path $(Build.SourcesDirectory)\.artifacts -Version ${{ parameters.overrideGuardianVersion }} Write-Host "##vso[task.setvariable variable=GuardianCliLocation]$guardianCliLocation" displayName: Install Guardian (Overridden) - ${{ if eq(parameters.overrideGuardianVersion, '') }}: - pwsh: | - Set-Location -Path $(Build.SourcesDirectory)\eng\common\sdl - . .\sdl.ps1 + . $(Build.SourcesDirectory)\eng\common\sdl\sdl.ps1 $guardianCliLocation = Install-Gdn -Path $(Build.SourcesDirectory)\.artifacts Write-Host "##vso[task.setvariable variable=GuardianCliLocation]$guardianCliLocation" displayName: Install Guardian diff --git a/eng/common/templates/steps/generate-sbom.yml b/eng/common/templates/steps/generate-sbom.yml index a06373f38fa5d..4cea8c33187c9 100644 --- a/eng/common/templates/steps/generate-sbom.yml +++ b/eng/common/templates/steps/generate-sbom.yml @@ -2,14 +2,12 @@ # PackageName - The name of the package this SBOM represents. # PackageVersion - The version of the package this SBOM represents. # ManifestDirPath - The path of the directory where the generated manifest files will be placed -# IgnoreDirectories - Directories to ignore for SBOM generation. This will be passed through to the CG component detector. parameters: PackageVersion: 7.0.0 BuildDropPath: '$(Build.SourcesDirectory)/artifacts' PackageName: '.NET' ManifestDirPath: $(Build.ArtifactStagingDirectory)/sbom - IgnoreDirectories: '' sbomContinueOnError: true steps: @@ -36,8 +34,6 @@ steps: BuildDropPath: ${{ parameters.buildDropPath }} PackageVersion: ${{ parameters.packageVersion }} ManifestDirPath: ${{ parameters.manifestDirPath }} - ${{ if ne(parameters.IgnoreDirectories, '') }}: - AdditionalComponentDetectorArgs: '--IgnoreDirectories ${{ parameters.IgnoreDirectories }}' - task: PublishPipelineArtifact@1 displayName: Publish SBOM manifest diff --git a/eng/common/templates/steps/source-build.yml b/eng/common/templates/steps/source-build.yml index a97a185a367a9..4624885e3bfeb 100644 --- a/eng/common/templates/steps/source-build.yml +++ b/eng/common/templates/steps/source-build.yml @@ -73,11 +73,6 @@ steps: publishArgs='--publish' fi - assetManifestFileName=SourceBuild_RidSpecific.xml - if [ '${{ parameters.platform.name }}' != '' ]; then - assetManifestFileName=SourceBuild_${{ parameters.platform.name }}.xml - fi - ${{ coalesce(parameters.platform.buildScript, './build.sh') }} --ci \ --configuration $buildConfig \ --restore --build --pack $publishArgs -bl \ @@ -87,8 +82,7 @@ steps: $targetRidArgs \ $runtimeOsArgs \ /p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \ - /p:ArcadeBuildFromSource=true \ - /p:AssetManifestFileName=$assetManifestFileName + /p:ArcadeBuildFromSource=true displayName: Build # Upload build logs for diagnosis. diff --git a/eng/common/templates/variables/pool-providers.yml b/eng/common/templates/variables/pool-providers.yml index a7b943c2fa4c1..99c80212bac19 100644 --- a/eng/common/templates/variables/pool-providers.yml +++ b/eng/common/templates/variables/pool-providers.yml @@ -1,22 +1,22 @@ -# Select a pool provider based off branch name. Anything with branch name containing 'release' must go into an -Svc pool, +# Select a pool provider based off branch name. Anything with branch name containing 'release' must go into an -Svc pool, # otherwise it should go into the "normal" pools. This separates out the queueing and billing of released branches. # Motivation: # Once a given branch of a repository's output has been officially "shipped" once, it is then considered to be COGS # (Cost of goods sold) and should be moved to a servicing pool provider. This allows both separation of queueing -# (allowing release builds and main PR builds to not intefere with each other) and billing (required for COGS. +# (allowing release builds and main PR builds to not intefere with each other) and billing (required for COGS) # Additionally, the pool provider name itself may be subject to change when the .NET Core Engineering Services # team needs to move resources around and create new and potentially differently-named pools. Using this template # file from an Arcade-ified repo helps guard against both having to update one's release/* branches and renaming. # How to use: # This yaml assumes your shipped product branches use the naming convention "release/..." (which many do). -# If we find alternate naming conventions in broad usage it can be added to the condition below. +# If we find alternate naming conventions in broad usage these can be added to the condition below. # # First, import the template in an arcade-ified repo to pick up the variables, e.g.: # # variables: -# - template: eng/common/templates/variables/pool-providers.yml +# - template: /eng/common/templates/variables/pool-providers.yml # # ... then anywhere specifying the pool provider use the runtime variables, # $(DncEngInternalBuildPool) and $ (DncEngPublicBuildPool), e.g.: @@ -26,23 +26,32 @@ # demands: ImageOverride -equals windows.vs2019.amd64 variables: -# Coalesce the target and source branches so we know when a PR targets a release branch -# If these variables are somehow missing, fall back to main (tends to have more capacity) -- name: BranchNameForPoolSelection - value: ${{ coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main') }} + # Coalesce the target and source branches so we know when a PR targets a release branch + # If these variables are somehow missing, fall back to main (tends to have more capacity) -# Any new -Svc alternative pools should have variables added here to allow for splitting work - -# Main branch pools -- ${{ if ne(contains(variables['BranchNameForPoolSelection'], 'release'), true) }}: + # Any new -Svc alternative pools should have variables added here to allow for splitting work - name: DncEngPublicBuildPool - value: NetCore-Public - - name: DncEngInternalBuildPool - value: NetCore1ESPool-Internal + value: $[ + replace( + replace( + eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), + True, + 'NetCore-Svc-Public' + ), + False, + 'NetCore-Public' + ) + ] -# Release branch pools -- ${{ if contains(variables['BranchNameForPoolSelection'], 'release') }}: - - name: DncEngPublicBuildPool - value: NetCore-Svc-Public - name: DncEngInternalBuildPool - value: NetCore1ESPool-Svc-Internal \ No newline at end of file + value: $[ + replace( + replace( + eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), + True, + 'NetCore1ESPool-Svc-Internal' + ), + False, + 'NetCore1ESPool-Internal' + ) + ] \ No newline at end of file diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index aba6308ad313c..021555cf3381a 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -365,8 +365,8 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = # If the version of msbuild is going to be xcopied, # use this version. Version matches a package here: - # https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet-eng&package=RoslynTools.MSBuild&protocolType=NuGet&version=17.2.1&view=overview - $defaultXCopyMSBuildVersion = '17.2.1' + # https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet-eng&package=RoslynTools.MSBuild&protocolType=NuGet&version=17.4.1&view=overview + $defaultXCopyMSBuildVersion = '17.4.1' if (!$vsRequirements) { if (Get-Member -InputObject $GlobalJson.tools -Name 'vs') { diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 6586eab458e55..e9a7ed9af6794 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -417,11 +417,12 @@ function MSBuild { Write-PipelineSetVariable -name "NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS" -value "20" Write-PipelineSetVariable -name "NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS" -value "20" - # https://github.com/dotnet/arcade/issues/11369 - disable new MSBuild server feature on linux - # This feature is new and can result in build failures from connection timeout errors. - export DOTNET_CLI_DO_NOT_USE_MSBUILD_SERVER=1 - Write-PipelineSetVariable -name "DOTNET_CLI_DO_NOT_USE_MSBUILD_SERVER" -value "1" - + export NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY=true + export NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT=6 + export NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS=1000 + Write-PipelineSetVariable -name "NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY" -value "true" + Write-PipelineSetVariable -name "NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT" -value "6" + Write-PipelineSetVariable -name "NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS" -value "1000" fi local toolset_dir="${_InitializeToolset%/*}" @@ -492,17 +493,6 @@ function MSBuild-Core { RunBuildTool "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@" } -function GetDarc { - darc_path="$temp_dir/darc" - version="$1" - - if [[ -n "$version" ]]; then - version="--darcversion $version" - fi - - "$eng_root/common/darc-init.sh" --toolpath "$darc_path" $version -} - ResolvePath "${BASH_SOURCE[0]}" _script_dir=`dirname "$_ResolvePath"` @@ -521,7 +511,7 @@ global_json_file="${repo_root}global.json" # determine if global.json contains a "runtimes" entry global_json_has_runtimes=false if command -v jq &> /dev/null; then - if jq -er '. | select(has("runtimes"))' "$global_json_file" &> /dev/null; then + if jq -e '.tools | has("runtimes")' "$global_json_file" &> /dev/null; then global_json_has_runtimes=true fi elif [[ "$(cat "$global_json_file")" =~ \"runtimes\"[[:space:]\:]*\{ ]]; then diff --git a/global.json b/global.json index cdcd9c978161e..4a1c2ad8b856a 100644 --- a/global.json +++ b/global.json @@ -1,11 +1,11 @@ { "sdk": { - "version": "7.0.100-rc.1.22431.12", + "version": "7.0.105", "allowPrerelease": true, "rollForward": "latestPatch" }, "tools": { - "dotnet": "7.0.100-rc.1.22431.12", + "dotnet": "7.0.105", "runtimes": { "dotnet": [ "3.1.0" @@ -17,7 +17,7 @@ "xcopy-msbuild": "17.2.1" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.22524.5", - "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.22524.5" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.23211.2", + "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.23211.2" } } From c2699446015b9dcd02aa61090fa5e6638efc4da2 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Thu, 26 Jan 2023 15:08:25 -0800 Subject: [PATCH 08/38] Don't overwrite binary logs (#66559) * Don't overwrite binary logs Several of our legs were calling `build.ps1 -binaryLog` in a row and that re-uses the binary log file name which causes an overwrite. This change allows us to specify the name and adds a warning if we do accidentally overwrite in the future. * enable trace for diff issue * Work around NuGet static graph restore bug https://github.com/NuGet/Home/issues/12373 --- azure-pipelines.yml | 2 +- eng/build.ps1 | 30 ++++++++++++++++++++++++++---- eng/common/tools.ps1 | 2 ++ 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d1a522d501568..79b992f97e7fe 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -211,7 +211,7 @@ jobs: displayName: Restore inputs: filePath: eng/build.ps1 - arguments: -configuration Debug -prepareMachine -ci -restore -binaryLog + arguments: -configuration Debug -prepareMachine -ci -restore -binaryLogName Restore.binlog - powershell: .\eng\test-rebuild.ps1 -ci -configuration Release displayName: Run BuildValidator diff --git a/eng/build.ps1 b/eng/build.ps1 index 3837556fef550..5b8d533b5ce48 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -34,6 +34,7 @@ param ( [switch]$bootstrap, [string]$bootstrapConfiguration = "Release", [switch][Alias('bl')]$binaryLog, + [string]$binaryLogName = "", [switch]$buildServerLog, [switch]$ci, [switch]$collectDumps, @@ -78,6 +79,7 @@ function Print-Usage() { Write-Host " -verbosity Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]" Write-Host " -deployExtensions Deploy built vsixes (short: -d)" Write-Host " -binaryLog Create MSBuild binary log (short: -bl)" + Write-Host " -binaryLogName Name of the binary log (default Build.binlog)" Write-Host " -buildServerLog Create Roslyn build server log" Write-Host "" Write-Host "Actions:" @@ -165,6 +167,10 @@ function Process-Arguments() { $script:applyOptimizationData = $false } + if ($binaryLogName -ne "") { + $script:binaryLog = $true + } + if ($ci) { $script:binaryLog = $true if ($bootstrap) { @@ -172,6 +178,10 @@ function Process-Arguments() { } } + if ($binaryLog -and ($binaryLogName -eq "")) { + $script:binaryLogName = "Build.binlog" + } + $anyUnit = $testDesktop -or $testCoreClr if ($anyUnit -and $testVsi) { Write-Host "Cannot combine unit and VSI testing" @@ -212,7 +222,14 @@ function BuildSolution() { Write-Host "$($solution):" - $bl = if ($binaryLog) { "/bl:" + (Join-Path $LogDir "Build.binlog") } else { "" } + $bl = "" + if ($binaryLog) { + $binaryLogPath = Join-Path $LogDir $binaryLogName + $bl = "/bl:" + $binaryLogPath + if ($ci -and (Test-Path $binaryLogPath)) { + Write-LogIssue -Type "warning" -Message "Overwriting binary log file $($binaryLogPath)" + } + } if ($buildServerLog) { ${env:ROSLYNCOMMANDLINELOGFILE} = Join-Path $LogDir "Build.Server.log" @@ -239,6 +256,11 @@ function BuildSolution() { $generateDocumentationFile = if ($skipDocumentation) { "/p:GenerateDocumentationFile=false" } else { "" } $roslynUseHardLinks = if ($ci) { "/p:ROSLYNUSEHARDLINKS=true" } else { "" } + # Temporarily disable RestoreUseStaticGraphEvaluation to work around this NuGet issue + # in our CI builds + # https://github.com/NuGet/Home/issues/12373 + $restoreUseStaticGraphEvaluation = if ($ci) { $false } else { $true } + try { MSBuild $toolsetBuildProj ` $bl ` @@ -258,7 +280,7 @@ function BuildSolution() { /p:TreatWarningsAsErrors=$warnAsError ` /p:EnableNgenOptimization=$applyOptimizationData ` /p:IbcOptimizationDataDir=$ibcDir ` - /p:RestoreUseStaticGraphEvaluation=true ` + /p:RestoreUseStaticGraphEvaluation=$restoreUseStaticGraphEvaluation ` /p:VisualStudioIbcDrop=$ibcDropName ` /p:VisualStudioDropAccessToken=$officialVisualStudioDropAccessToken ` $suppressExtensionDeployment ` @@ -690,7 +712,7 @@ try { catch { if ($ci) { - echo "##vso[task.logissue type=error](NETCORE_ENGINEERING_TELEMETRY=Build) Build failed" + Write-LogIssue -Type "error" -Message "(NETCORE_ENGINEERING_TELEMETRY=Build) Build failed" } throw $_ } @@ -708,7 +730,7 @@ try { catch { if ($ci) { - echo "##vso[task.logissue type=error](NETCORE_ENGINEERING_TELEMETRY=Test) Tests failed" + Write-LogIssue -Type "error" -Message "(NETCORE_ENGINEERING_TELEMETRY=Test) Tests failed" } throw $_ } diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 021555cf3381a..a688564404c62 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -802,6 +802,8 @@ function MSBuild-Core() { $env:ARCADE_BUILD_TOOL_COMMAND = "$($buildTool.Path) $cmdArgs" + Write-Host "Exec $($buildTool.Path) and $cmdArgs" + $exitCode = Exec-Process $buildTool.Path $cmdArgs if ($exitCode -ne 0) { From d32f3130239e920b4b3fcd0f21f6510329043d4e Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Fri, 3 Feb 2023 13:34:31 -0800 Subject: [PATCH 09/38] Don't overwrite binary logs in CI (#66683) * Don't overwrite binary logs in CI This will make it an error whenever we overwrite a binary log during CI. Doing so means we've lost one of our main tools for investigating build failures. Turning this into an error so we don't make the mistake again. * actually fail * fixup --- eng/build.ps1 | 3 ++- eng/pipelines/build-windows-job.yml | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/eng/build.ps1 b/eng/build.ps1 index 5b8d533b5ce48..b64c3646a478d 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -227,7 +227,8 @@ function BuildSolution() { $binaryLogPath = Join-Path $LogDir $binaryLogName $bl = "/bl:" + $binaryLogPath if ($ci -and (Test-Path $binaryLogPath)) { - Write-LogIssue -Type "warning" -Message "Overwriting binary log file $($binaryLogPath)" + Write-LogIssue -Type "error" -Message "Overwriting binary log file $($binaryLogPath)" + throw "Overwriting binary log files" } } diff --git a/eng/pipelines/build-windows-job.yml b/eng/pipelines/build-windows-job.yml index eaba27ebaf7b1..4aba1ec632a75 100644 --- a/eng/pipelines/build-windows-job.yml +++ b/eng/pipelines/build-windows-job.yml @@ -37,13 +37,13 @@ jobs: displayName: Restore inputs: filePath: eng/build.ps1 - arguments: -configuration ${{ parameters.configuration }} -prepareMachine -ci -restore -binaryLog + arguments: -configuration ${{ parameters.configuration }} -prepareMachine -ci -restore -binaryLogName Restore.binlog - task: PowerShell@2 displayName: Build inputs: filePath: eng/build.ps1 - arguments: -configuration ${{ parameters.configuration }} -prepareMachine -ci -build -publish -binaryLog -skipDocumentation ${{ parameters.buildArguments }} + arguments: -configuration ${{ parameters.configuration }} -prepareMachine -ci -build -publish -binaryLogName Build.binlog -skipDocumentation ${{ parameters.buildArguments }} - task: PowerShell@2 displayName: Prepare Unit Tests From bd47e181374c754be2858d4acb9278aa3a82e1f1 Mon Sep 17 00:00:00 2001 From: David Barbet Date: Mon, 30 Jan 2023 09:47:08 -0800 Subject: [PATCH 10/38] Disable static restore in more locations (#66567) * Disable static restore in more locations * Run compilers CI when build scripts change * Include compiler generators in compilers code change check * Remove separate restore in bootstrap build --- eng/build-utils.ps1 | 4 ++++ eng/test-determinism.ps1 | 7 ++++++- eng/test-rebuild.ps1 | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/eng/build-utils.ps1 b/eng/build-utils.ps1 index 02a535cd42c40..42bd1a09730a5 100644 --- a/eng/build-utils.ps1 +++ b/eng/build-utils.ps1 @@ -301,6 +301,10 @@ function Run-MSBuild([string]$projectFilePath, [string]$buildArgs = "", [string] if ($ci) { $args += " /p:ContinuousIntegrationBuild=true" + # Temporarily disable RestoreUseStaticGraphEvaluation to work around this NuGet issue + # in our CI builds + # https://github.com/NuGet/Home/issues/12373 + $args += " /p:RestoreUseStaticGraphEvaluation=false" } if ($bootstrapDir -ne "") { diff --git a/eng/test-determinism.ps1 b/eng/test-determinism.ps1 index e7c36de72ba8d..dc5e3e59dbfd0 100644 --- a/eng/test-determinism.ps1 +++ b/eng/test-determinism.ps1 @@ -48,6 +48,11 @@ function Run-Build([string]$rootDir, [string]$logFileName) { Stop-Processes + # Temporarily disable RestoreUseStaticGraphEvaluation to work around this NuGet issue + # in our CI builds + # https://github.com/NuGet/Home/issues/12373 + $restoreUseStaticGraphEvaluation = if ($ci) { $false } else { $true } + Write-Host "Building $solution using $bootstrapDir" MSBuild $toolsetBuildProj ` /p:Projects=$solution ` @@ -61,7 +66,7 @@ function Run-Build([string]$rootDir, [string]$logFileName) { /p:BootstrapBuildPath=$bootstrapDir ` /p:RunAnalyzers=false ` /p:RunAnalyzersDuringBuild=false ` - /p:RestoreUseStaticGraphEvaluation=true ` + /p:RestoreUseStaticGraphEvaluation=$restoreUseStaticGraphEvaluation ` /bl:$logFilePath Stop-Processes diff --git a/eng/test-rebuild.ps1 b/eng/test-rebuild.ps1 index 8cd2f7adc0731..1ebf48a0e3fcb 100644 --- a/eng/test-rebuild.ps1 +++ b/eng/test-rebuild.ps1 @@ -33,7 +33,7 @@ try { if (-not $noBuild) { Write-Host "Building Roslyn" - Exec-Block { & (Join-Path $PSScriptRoot "build.ps1") -build -bootstrap -ci:$ci -useGlobalNuGetCache:$useGlobalNuGetCache -configuration:$configuration -pack -binaryLog } + Exec-Block { & (Join-Path $PSScriptRoot "build.ps1") -restore -build -bootstrap -ci:$ci -useGlobalNuGetCache:$useGlobalNuGetCache -configuration:$configuration -pack -binaryLog } } $dotnetInstallDir = (InitializeDotNetCli -install:$true) From e337be8987c445817d5f579573af05cb0e99ffcd Mon Sep 17 00:00:00 2001 From: Gen Lu Date: Tue, 21 Mar 2023 10:56:58 -0700 Subject: [PATCH 11/38] Merge pull request #67381 from genlu/Fix17.5Ci Fix 17.5 CI build --- src/Tools/BuildBoss/BuildBoss.csproj | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Tools/BuildBoss/BuildBoss.csproj b/src/Tools/BuildBoss/BuildBoss.csproj index b3e129fb7769b..ef3d0eb4fe7d1 100644 --- a/src/Tools/BuildBoss/BuildBoss.csproj +++ b/src/Tools/BuildBoss/BuildBoss.csproj @@ -7,10 +7,18 @@ false false false + + + 2.1.787 + From 7f2dc1ebc614b8b409e82d10cd7624fd9ff275e9 Mon Sep 17 00:00:00 2001 From: Shen Chen Date: Thu, 20 Apr 2023 15:54:07 -0700 Subject: [PATCH 12/38] Remove nuget feed --- NuGet.config | 2 -- 1 file changed, 2 deletions(-) diff --git a/NuGet.config b/NuGet.config index aeceaf3a65ee5..513b93df1e591 100644 --- a/NuGet.config +++ b/NuGet.config @@ -13,8 +13,6 @@ - - From 1f28c5956fd17fbc2939948ed266c08e1f20baf9 Mon Sep 17 00:00:00 2001 From: David Barbet Date: Thu, 20 Apr 2023 17:47:26 -0700 Subject: [PATCH 13/38] Disable tests on servicing branch to get building --- src/Compilers/CSharp/Test/Emit/PDB/PDBConstantTests.cs | 10 +++++----- .../VisualBasic/Test/Emit/PDB/PDBConstLocalTests.vb | 2 +- src/Compilers/VisualBasic/Test/Emit/PDB/PDBTests.vb | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Compilers/CSharp/Test/Emit/PDB/PDBConstantTests.cs b/src/Compilers/CSharp/Test/Emit/PDB/PDBConstantTests.cs index 4ec1a41d83fbc..106852faf2128 100644 --- a/src/Compilers/CSharp/Test/Emit/PDB/PDBConstantTests.cs +++ b/src/Compilers/CSharp/Test/Emit/PDB/PDBConstantTests.cs @@ -16,7 +16,7 @@ namespace Microsoft.CodeAnalysis.CSharp.UnitTests.PDB { public class PDBConstantTests : CSharpTestBase { - [Fact] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/67908")] public void StringsWithSurrogateChar() { var source = @" @@ -84,7 +84,7 @@ public static void Main() } [WorkItem(546862, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546862")] - [Fact] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/67908")] public void InvalidUnicodeString() { var source = @" @@ -145,7 +145,7 @@ public static void Main() ", format: DebugInformationFormat.PortablePdb); } - [Fact] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/67908")] public void AllTypes() { var source = @" @@ -466,7 +466,7 @@ IEnumerable M() "); } - [Fact] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/67908")] [WorkItem(33564, "https://github.com/dotnet/roslyn/issues/33564")] public void LocalConstantsTypes() { @@ -648,7 +648,7 @@ this is a string constant that is too long to fit into the PDB } [WorkItem(178988, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/178988")] - [Fact] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/67908")] public void StringWithNulCharacter_MaxSupportedLength() { const int length = 2031; diff --git a/src/Compilers/VisualBasic/Test/Emit/PDB/PDBConstLocalTests.vb b/src/Compilers/VisualBasic/Test/Emit/PDB/PDBConstLocalTests.vb index 8c223892be73d..69ee5839bde31 100644 --- a/src/Compilers/VisualBasic/Test/Emit/PDB/PDBConstLocalTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/PDB/PDBConstLocalTests.vb @@ -144,7 +144,7 @@ class C End Sub #End If - + Public Sub TestLocalConstantsTypes() diff --git a/src/Compilers/VisualBasic/Test/Emit/PDB/PDBTests.vb b/src/Compilers/VisualBasic/Test/Emit/PDB/PDBTests.vb index ff467108cbbff..2446298d932b4 100644 --- a/src/Compilers/VisualBasic/Test/Emit/PDB/PDBTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/PDB/PDBTests.vb @@ -4395,7 +4395,7 @@ End Class ) End Sub - + Public Sub Constant_AllTypes() Dim source = From 2151c15091320176ef712c3b4f9bd92bb65df73b Mon Sep 17 00:00:00 2001 From: David Barbet Date: Fri, 21 Apr 2023 12:46:42 -0700 Subject: [PATCH 14/38] Remove restore on rebuild step --- azure-pipelines.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 79b992f97e7fe..6eb5960a9546e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -207,12 +207,6 @@ jobs: steps: - template: eng/pipelines/checkout-windows-task.yml - - task: PowerShell@2 - displayName: Restore - inputs: - filePath: eng/build.ps1 - arguments: -configuration Debug -prepareMachine -ci -restore -binaryLogName Restore.binlog - - powershell: .\eng\test-rebuild.ps1 -ci -configuration Release displayName: Run BuildValidator From fad8e607211e2e42b8972ecf3c37f41eadf2cbf0 Mon Sep 17 00:00:00 2001 From: David Barbet Date: Fri, 21 Apr 2023 14:03:59 -0700 Subject: [PATCH 15/38] Revert "Disable tests on servicing branch to get building" This reverts commit 1f28c5956fd17fbc2939948ed266c08e1f20baf9. --- src/Compilers/CSharp/Test/Emit/PDB/PDBConstantTests.cs | 10 +++++----- .../VisualBasic/Test/Emit/PDB/PDBConstLocalTests.vb | 2 +- src/Compilers/VisualBasic/Test/Emit/PDB/PDBTests.vb | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Compilers/CSharp/Test/Emit/PDB/PDBConstantTests.cs b/src/Compilers/CSharp/Test/Emit/PDB/PDBConstantTests.cs index 106852faf2128..4ec1a41d83fbc 100644 --- a/src/Compilers/CSharp/Test/Emit/PDB/PDBConstantTests.cs +++ b/src/Compilers/CSharp/Test/Emit/PDB/PDBConstantTests.cs @@ -16,7 +16,7 @@ namespace Microsoft.CodeAnalysis.CSharp.UnitTests.PDB { public class PDBConstantTests : CSharpTestBase { - [Fact(Skip = "https://github.com/dotnet/roslyn/issues/67908")] + [Fact] public void StringsWithSurrogateChar() { var source = @" @@ -84,7 +84,7 @@ public static void Main() } [WorkItem(546862, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546862")] - [Fact(Skip = "https://github.com/dotnet/roslyn/issues/67908")] + [Fact] public void InvalidUnicodeString() { var source = @" @@ -145,7 +145,7 @@ public static void Main() ", format: DebugInformationFormat.PortablePdb); } - [Fact(Skip = "https://github.com/dotnet/roslyn/issues/67908")] + [Fact] public void AllTypes() { var source = @" @@ -466,7 +466,7 @@ IEnumerable M() "); } - [Fact(Skip = "https://github.com/dotnet/roslyn/issues/67908")] + [Fact] [WorkItem(33564, "https://github.com/dotnet/roslyn/issues/33564")] public void LocalConstantsTypes() { @@ -648,7 +648,7 @@ this is a string constant that is too long to fit into the PDB } [WorkItem(178988, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/178988")] - [Fact(Skip = "https://github.com/dotnet/roslyn/issues/67908")] + [Fact] public void StringWithNulCharacter_MaxSupportedLength() { const int length = 2031; diff --git a/src/Compilers/VisualBasic/Test/Emit/PDB/PDBConstLocalTests.vb b/src/Compilers/VisualBasic/Test/Emit/PDB/PDBConstLocalTests.vb index 69ee5839bde31..8c223892be73d 100644 --- a/src/Compilers/VisualBasic/Test/Emit/PDB/PDBConstLocalTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/PDB/PDBConstLocalTests.vb @@ -144,7 +144,7 @@ class C End Sub #End If - + Public Sub TestLocalConstantsTypes() diff --git a/src/Compilers/VisualBasic/Test/Emit/PDB/PDBTests.vb b/src/Compilers/VisualBasic/Test/Emit/PDB/PDBTests.vb index 0612980c96691..8039de658d6eb 100644 --- a/src/Compilers/VisualBasic/Test/Emit/PDB/PDBTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/PDB/PDBTests.vb @@ -4397,7 +4397,7 @@ End Class ) End Sub - + Public Sub Constant_AllTypes() Dim source = From 59db54a6f373cf2bdeb2a3fdf22a0c33741640ee Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 22 Apr 2023 12:55:01 +0000 Subject: [PATCH 16/38] Update dependencies from https://github.com/dotnet/arcade build 20230421.2 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 7.0.0-beta.23211.2 -> To Version 7.0.0-beta.23221.2 --- eng/Version.Details.xml | 8 ++++---- eng/common/templates/job/job.yml | 12 ++++++++---- eng/common/templates/steps/component-governance.yml | 10 ++++++++++ eng/common/tools.ps1 | 2 -- global.json | 4 ++-- 5 files changed, 24 insertions(+), 12 deletions(-) create mode 100644 eng/common/templates/steps/component-governance.yml diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f4ab434f034a9..cc4caaa1e190a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -13,18 +13,18 @@ - + https://github.com/dotnet/arcade - 7c5e5a782c67460b123c8e41d484ebcca8002c93 + 746a46f3963c9359da5dab5425bc0feaf9e88068 https://github.com/dotnet/roslyn c1d8c6f043bc80425c6828455eb57f8a404759c6 - + https://github.com/dotnet/arcade - 7c5e5a782c67460b123c8e41d484ebcca8002c93 + 746a46f3963c9359da5dab5425bc0feaf9e88068 diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index e3ba9398016be..3cb5145eabf74 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -24,7 +24,7 @@ parameters: enablePublishBuildAssets: false enablePublishTestResults: false enablePublishUsingPipelines: false - disableComponentGovernance: false + disableComponentGovernance: '' mergeTestResults: false testRunTitle: '' testResultsFormat: '' @@ -142,9 +142,13 @@ jobs: richNavLogOutputDirectory: $(Build.SourcesDirectory)/artifacts/bin continueOnError: true - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), ne(parameters.disableComponentGovernance, 'true')) }}: - - task: ComponentGovernanceComponentDetection@0 - continueOnError: true + - template: /eng/common/templates/steps/component-governance.yml + parameters: + ${{ if eq(parameters.disableComponentGovernance, '') }}: + ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.runAsPublic, 'false'), or(contains(variables['Build.SourceBranch'], 'internal/release'), eq(variables['Build.SourceBranch'], 'main'))) }}: + disableComponentGovernance: false + ${{ else }}: + disableComponentGovernance: true - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: diff --git a/eng/common/templates/steps/component-governance.yml b/eng/common/templates/steps/component-governance.yml new file mode 100644 index 0000000000000..babc2757d8d12 --- /dev/null +++ b/eng/common/templates/steps/component-governance.yml @@ -0,0 +1,10 @@ +parameters: + disableComponentGovernance: false + +steps: +- ${{ if eq(parameters.disableComponentGovernance, 'true') }}: + - script: "echo ##vso[task.setvariable variable=skipComponentGovernanceDetection]true" + displayName: Set skipComponentGovernanceDetection variable +- ${{ if ne(parameters.disableComponentGovernance, 'true') }}: + - task: ComponentGovernanceComponentDetection@0 + continueOnError: true \ No newline at end of file diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index a688564404c62..021555cf3381a 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -802,8 +802,6 @@ function MSBuild-Core() { $env:ARCADE_BUILD_TOOL_COMMAND = "$($buildTool.Path) $cmdArgs" - Write-Host "Exec $($buildTool.Path) and $cmdArgs" - $exitCode = Exec-Process $buildTool.Path $cmdArgs if ($exitCode -ne 0) { diff --git a/global.json b/global.json index 4a1c2ad8b856a..38cfe4926d0a8 100644 --- a/global.json +++ b/global.json @@ -17,7 +17,7 @@ "xcopy-msbuild": "17.2.1" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.23211.2", - "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.23211.2" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.23221.2", + "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.23221.2" } } From 43f6c3d5e017b869a3ae05129a6bc19860ca87b1 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 29 Apr 2023 12:58:18 +0000 Subject: [PATCH 17/38] Update dependencies from https://github.com/dotnet/arcade build 20230428.7 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 7.0.0-beta.23211.2 -> To Version 7.0.0-beta.23228.7 --- eng/Version.Details.xml | 8 ++++---- global.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index cc4caaa1e190a..1dc8bec6c6070 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -13,18 +13,18 @@ - + https://github.com/dotnet/arcade - 746a46f3963c9359da5dab5425bc0feaf9e88068 + df8799988af6503cbcd9544713d30732328c8c57 https://github.com/dotnet/roslyn c1d8c6f043bc80425c6828455eb57f8a404759c6 - + https://github.com/dotnet/arcade - 746a46f3963c9359da5dab5425bc0feaf9e88068 + df8799988af6503cbcd9544713d30732328c8c57 diff --git a/global.json b/global.json index 38cfe4926d0a8..4bd98a3164b08 100644 --- a/global.json +++ b/global.json @@ -17,7 +17,7 @@ "xcopy-msbuild": "17.2.1" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.23221.2", - "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.23221.2" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.23228.7", + "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.23228.7" } } From 38d0bd1fdc4967c6becc20bc8b6ab4fb6fab9a16 Mon Sep 17 00:00:00 2001 From: Shen Chen Date: Tue, 2 May 2023 14:40:47 -0700 Subject: [PATCH 18/38] Remove interactiveHost32 --- ...oft.VisualStudio.LanguageServices.CSharp.UnitTests.csproj | 1 - .../Microsoft.VisualStudio.LanguageServices.UnitTests.vbproj | 1 - ...soft.VisualStudio.LanguageServices.Test.Utilities2.vbproj | 5 ++--- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/VisualStudio/CSharp/Test/Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests.csproj b/src/VisualStudio/CSharp/Test/Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests.csproj index f665c0e02b574..751821d084341 100644 --- a/src/VisualStudio/CSharp/Test/Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests.csproj +++ b/src/VisualStudio/CSharp/Test/Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests.csproj @@ -46,7 +46,6 @@ - diff --git a/src/VisualStudio/Core/Test/Microsoft.VisualStudio.LanguageServices.UnitTests.vbproj b/src/VisualStudio/Core/Test/Microsoft.VisualStudio.LanguageServices.UnitTests.vbproj index e39c6cfe5643f..94ce52743db98 100644 --- a/src/VisualStudio/Core/Test/Microsoft.VisualStudio.LanguageServices.UnitTests.vbproj +++ b/src/VisualStudio/Core/Test/Microsoft.VisualStudio.LanguageServices.UnitTests.vbproj @@ -41,7 +41,6 @@ - diff --git a/src/VisualStudio/TestUtilities2/Microsoft.VisualStudio.LanguageServices.Test.Utilities2.vbproj b/src/VisualStudio/TestUtilities2/Microsoft.VisualStudio.LanguageServices.Test.Utilities2.vbproj index fe402789f1967..f5e64d23ff76f 100644 --- a/src/VisualStudio/TestUtilities2/Microsoft.VisualStudio.LanguageServices.Test.Utilities2.vbproj +++ b/src/VisualStudio/TestUtilities2/Microsoft.VisualStudio.LanguageServices.Test.Utilities2.vbproj @@ -14,7 +14,6 @@ - @@ -73,7 +72,7 @@ - + @@ -83,4 +82,4 @@ - \ No newline at end of file + From cd103c22892cf1ea387ad2cdecfe23274e25828c Mon Sep 17 00:00:00 2001 From: Shen Chen Date: Wed, 3 May 2023 11:14:51 -0700 Subject: [PATCH 19/38] Use different binlog name --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2e478f2487f2c..2a6978ecf0699 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -222,7 +222,7 @@ stages: displayName: Restore inputs: filePath: eng/build.ps1 - arguments: -configuration Release -prepareMachine -ci -restore -binaryLog + arguments: -configuration Release -prepareMachine -ci -restore -binaryLog -binaryLogName Restore.binlog - task: PowerShell@2 displayName: Build From 8bc06dba9a90dd898de3b5d9aa4915c60223a292 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 29 Sep 2022 10:43:03 -0700 Subject: [PATCH 20/38] Listen to build manager events to know when build is complete --- .../InProcess/SolutionExplorerInProcess.cs | 191 +++++++++++++++++- 1 file changed, 187 insertions(+), 4 deletions(-) diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs index 3731514283cd0..f76beedad17b8 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs @@ -31,6 +31,7 @@ using Reference5 = VSLangProj110.Reference5; using Reference2 = VSLangProj2.Reference2; using VSProject3 = VSLangProj140.VSProject3; +using Microsoft.VisualStudio.LanguageServices.Interactive; namespace Microsoft.VisualStudio.Extensibility.Testing { @@ -553,12 +554,29 @@ private async Task WaitForBuildToFinishAsync(IVsOutputWindowPane buildOu { await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); - await KnownUIContexts.SolutionExistsAndNotBuildingAndNotDebuggingContext; + var buildManager = await GetRequiredGlobalServiceAsync(cancellationToken); + using var semaphore = new SemaphoreSlim(1); + using var solutionEvents = new UpdateSolutionEvents(buildManager); + await semaphore.WaitAsync(); + void HandleUpdateSolutionDone(bool succeeded, bool modified, bool canceled) => semaphore.Release(); + solutionEvents.OnUpdateSolutionDone += HandleUpdateSolutionDone; + try + { + await semaphore.WaitAsync(); + } + finally + { + solutionEvents.OnUpdateSolutionDone -= HandleUpdateSolutionDone; + } // Force the error list to update ErrorHandler.ThrowOnFailure(buildOutputWindowPane.FlushToTaskList()); - var textView = (IVsTextView)buildOutputWindowPane; + if (buildOutputWindowPane is not IVsTextView textView) + { + throw new InvalidOperationException($"{nameof(IVsOutputWindowPane)} should implement {nameof(IVsTextView)}"); + } + var wpfTextViewHost = await textView.GetTextViewHostAsync(JoinableTaskFactory, cancellationToken); var lines = wpfTextViewHost.TextView.TextViewLines; if (lines.Count < 1) @@ -566,8 +584,17 @@ private async Task WaitForBuildToFinishAsync(IVsOutputWindowPane buildOu return string.Empty; } - // The build summary line should be second to last in the output window - return lines[^2].Extent.GetText(); + // Find the build summary line + for (int index = lines.Count - 1; index > 0; index--) + { + var lineText = lines[index].Extent.GetText(); + if (lineText.StartsWith("========== Build:")) + { + return lineText; + } + } + + return string.Empty; } public async Task GetBuildOutputWindowPaneAsync(CancellationToken cancellationToken) @@ -682,4 +709,160 @@ private static string CreateTemporaryPath() }); } } + + internal sealed class UpdateSolutionEvents : IVsUpdateSolutionEvents, IVsUpdateSolutionEvents2, IDisposable + { + private uint _cookie; + private readonly IVsSolutionBuildManager2 _solutionBuildManager; + + internal delegate void UpdateSolutionDoneEvent(bool succeeded, bool modified, bool canceled); + + internal delegate void UpdateSolutionBeginEvent(ref bool cancel); + + internal delegate void UpdateSolutionStartUpdateEvent(ref bool cancel); + + internal delegate void UpdateProjectConfigDoneEvent(IVsHierarchy projectHierarchy, IVsCfg projectConfig, int success); + + internal delegate void UpdateProjectConfigBeginEvent(IVsHierarchy projectHierarchy, IVsCfg projectConfig); + + public event UpdateSolutionDoneEvent? OnUpdateSolutionDone; + + public event UpdateSolutionBeginEvent? OnUpdateSolutionBegin; + + public event UpdateSolutionStartUpdateEvent? OnUpdateSolutionStartUpdate; + + public event Action? OnActiveProjectConfigurationChange; + + public event Action? OnUpdateSolutionCancel; + + public event UpdateProjectConfigDoneEvent? OnUpdateProjectConfigDone; + + public event UpdateProjectConfigBeginEvent? OnUpdateProjectConfigBegin; + + internal UpdateSolutionEvents(IVsSolutionBuildManager2 solutionBuildManager) + { + ThreadHelper.ThrowIfNotOnUIThread(); + + _solutionBuildManager = solutionBuildManager; + ErrorHandler.ThrowOnFailure(solutionBuildManager.AdviseUpdateSolutionEvents(this, out _cookie)); + } + + int IVsUpdateSolutionEvents.UpdateSolution_Begin(ref int pfCancelUpdate) + { + var cancel = false; + OnUpdateSolutionBegin?.Invoke(ref cancel); + if (cancel) + { + pfCancelUpdate = 1; + } + + return 0; + } + + int IVsUpdateSolutionEvents.UpdateSolution_Done(int fSucceeded, int fModified, int fCancelCommand) + { + OnUpdateSolutionDone?.Invoke(fSucceeded != 0, fModified != 0, fCancelCommand != 0); + return 0; + } + + int IVsUpdateSolutionEvents.UpdateSolution_StartUpdate(ref int pfCancelUpdate) + { + return UpdateSolution_StartUpdate(ref pfCancelUpdate); + } + + int IVsUpdateSolutionEvents.UpdateSolution_Cancel() + { + OnUpdateSolutionCancel?.Invoke(); + return 0; + } + + int IVsUpdateSolutionEvents.OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy) + { + return OnActiveProjectCfgChange(pIVsHierarchy); + } + + int IVsUpdateSolutionEvents2.UpdateSolution_Begin(ref int pfCancelUpdate) + { + var cancel = false; + OnUpdateSolutionBegin?.Invoke(ref cancel); + if (cancel) + { + pfCancelUpdate = 1; + } + + return 0; + } + + int IVsUpdateSolutionEvents2.UpdateSolution_Done(int fSucceeded, int fModified, int fCancelCommand) + { + OnUpdateSolutionDone?.Invoke(fSucceeded != 0, fModified != 0, fCancelCommand != 0); + return 0; + } + + int IVsUpdateSolutionEvents2.UpdateSolution_StartUpdate(ref int pfCancelUpdate) + { + return UpdateSolution_StartUpdate(ref pfCancelUpdate); + } + + int IVsUpdateSolutionEvents2.UpdateSolution_Cancel() + { + OnUpdateSolutionCancel?.Invoke(); + return 0; + } + + int IVsUpdateSolutionEvents2.OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy) + { + return OnActiveProjectCfgChange(pIVsHierarchy); + } + + int IVsUpdateSolutionEvents2.UpdateProjectCfg_Begin(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, ref int pfCancel) + { + OnUpdateProjectConfigBegin?.Invoke(pHierProj, pCfgProj); + return 0; + } + + int IVsUpdateSolutionEvents2.UpdateProjectCfg_Done(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, int fSuccess, int fCancel) + { + OnUpdateProjectConfigDone?.Invoke(pHierProj, pCfgProj, fSuccess); + return 0; + } + + private int UpdateSolution_StartUpdate(ref int pfCancelUpdate) + { + var cancel = false; + OnUpdateSolutionStartUpdate?.Invoke(ref cancel); + if (cancel) + { + pfCancelUpdate = 1; + } + + return 0; + } + + private int OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy) + { + OnActiveProjectConfigurationChange?.Invoke(); + return 0; + } + + void IDisposable.Dispose() + { + ThreadHelper.ThrowIfNotOnUIThread(); + + OnUpdateSolutionDone = null; + OnUpdateSolutionBegin = null; + OnUpdateSolutionStartUpdate = null; + OnActiveProjectConfigurationChange = null; + OnUpdateSolutionCancel = null; + OnUpdateProjectConfigDone = null; + OnUpdateProjectConfigBegin = null; + + if (_cookie != 0) + { + var tempCookie = _cookie; + _cookie = 0; + ErrorHandler.ThrowOnFailure(_solutionBuildManager.UnadviseUpdateSolutionEvents(tempCookie)); + } + } + } } From fd671267439c7e16799f9ef5872349e93524fe7e Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 29 Sep 2022 11:19:42 -0700 Subject: [PATCH 21/38] Remove unused interface implementation --- .../InProcess/SolutionExplorerInProcess.cs | 75 ++----------------- 1 file changed, 8 insertions(+), 67 deletions(-) diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs index f76beedad17b8..a2db2eeb4dfc1 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs @@ -32,6 +32,7 @@ using Reference2 = VSLangProj2.Reference2; using VSProject3 = VSLangProj140.VSProject3; using Microsoft.VisualStudio.LanguageServices.Interactive; +using Microsoft.CodeAnalysis.AddFileBanner; namespace Microsoft.VisualStudio.Extensibility.Testing { @@ -555,14 +556,14 @@ private async Task WaitForBuildToFinishAsync(IVsOutputWindowPane buildOu await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); var buildManager = await GetRequiredGlobalServiceAsync(cancellationToken); - using var semaphore = new SemaphoreSlim(1); using var solutionEvents = new UpdateSolutionEvents(buildManager); - await semaphore.WaitAsync(); - void HandleUpdateSolutionDone(bool succeeded, bool modified, bool canceled) => semaphore.Release(); + var buildCompleteTaskCompletionSource = new TaskCompletionSource(); + + void HandleUpdateSolutionDone(bool succeeded, bool modified, bool canceled) => buildCompleteTaskCompletionSource.SetResult(succeeded); solutionEvents.OnUpdateSolutionDone += HandleUpdateSolutionDone; try { - await semaphore.WaitAsync(); + await buildCompleteTaskCompletionSource.Task; } finally { @@ -572,11 +573,7 @@ private async Task WaitForBuildToFinishAsync(IVsOutputWindowPane buildOu // Force the error list to update ErrorHandler.ThrowOnFailure(buildOutputWindowPane.FlushToTaskList()); - if (buildOutputWindowPane is not IVsTextView textView) - { - throw new InvalidOperationException($"{nameof(IVsOutputWindowPane)} should implement {nameof(IVsTextView)}"); - } - + var textView = (IVsTextView)buildOutputWindowPane; var wpfTextViewHost = await textView.GetTextViewHostAsync(JoinableTaskFactory, cancellationToken); var lines = wpfTextViewHost.TextView.TextViewLines; if (lines.Count < 1) @@ -585,7 +582,7 @@ private async Task WaitForBuildToFinishAsync(IVsOutputWindowPane buildOu } // Find the build summary line - for (int index = lines.Count - 1; index > 0; index--) + for (var index = lines.Count - 1; index > 0; index--) { var lineText = lines[index].Extent.GetText(); if (lineText.StartsWith("========== Build:")) @@ -710,7 +707,7 @@ private static string CreateTemporaryPath() } } - internal sealed class UpdateSolutionEvents : IVsUpdateSolutionEvents, IVsUpdateSolutionEvents2, IDisposable + internal sealed class UpdateSolutionEvents : IVsUpdateSolutionEvents, IDisposable { private uint _cookie; private readonly IVsSolutionBuildManager2 _solutionBuildManager; @@ -721,10 +718,6 @@ internal sealed class UpdateSolutionEvents : IVsUpdateSolutionEvents, IVsUpdateS internal delegate void UpdateSolutionStartUpdateEvent(ref bool cancel); - internal delegate void UpdateProjectConfigDoneEvent(IVsHierarchy projectHierarchy, IVsCfg projectConfig, int success); - - internal delegate void UpdateProjectConfigBeginEvent(IVsHierarchy projectHierarchy, IVsCfg projectConfig); - public event UpdateSolutionDoneEvent? OnUpdateSolutionDone; public event UpdateSolutionBeginEvent? OnUpdateSolutionBegin; @@ -735,10 +728,6 @@ internal sealed class UpdateSolutionEvents : IVsUpdateSolutionEvents, IVsUpdateS public event Action? OnUpdateSolutionCancel; - public event UpdateProjectConfigDoneEvent? OnUpdateProjectConfigDone; - - public event UpdateProjectConfigBeginEvent? OnUpdateProjectConfigBegin; - internal UpdateSolutionEvents(IVsSolutionBuildManager2 solutionBuildManager) { ThreadHelper.ThrowIfNotOnUIThread(); @@ -781,52 +770,6 @@ int IVsUpdateSolutionEvents.OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy) return OnActiveProjectCfgChange(pIVsHierarchy); } - int IVsUpdateSolutionEvents2.UpdateSolution_Begin(ref int pfCancelUpdate) - { - var cancel = false; - OnUpdateSolutionBegin?.Invoke(ref cancel); - if (cancel) - { - pfCancelUpdate = 1; - } - - return 0; - } - - int IVsUpdateSolutionEvents2.UpdateSolution_Done(int fSucceeded, int fModified, int fCancelCommand) - { - OnUpdateSolutionDone?.Invoke(fSucceeded != 0, fModified != 0, fCancelCommand != 0); - return 0; - } - - int IVsUpdateSolutionEvents2.UpdateSolution_StartUpdate(ref int pfCancelUpdate) - { - return UpdateSolution_StartUpdate(ref pfCancelUpdate); - } - - int IVsUpdateSolutionEvents2.UpdateSolution_Cancel() - { - OnUpdateSolutionCancel?.Invoke(); - return 0; - } - - int IVsUpdateSolutionEvents2.OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy) - { - return OnActiveProjectCfgChange(pIVsHierarchy); - } - - int IVsUpdateSolutionEvents2.UpdateProjectCfg_Begin(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, ref int pfCancel) - { - OnUpdateProjectConfigBegin?.Invoke(pHierProj, pCfgProj); - return 0; - } - - int IVsUpdateSolutionEvents2.UpdateProjectCfg_Done(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, int fSuccess, int fCancel) - { - OnUpdateProjectConfigDone?.Invoke(pHierProj, pCfgProj, fSuccess); - return 0; - } - private int UpdateSolution_StartUpdate(ref int pfCancelUpdate) { var cancel = false; @@ -854,8 +797,6 @@ void IDisposable.Dispose() OnUpdateSolutionStartUpdate = null; OnActiveProjectConfigurationChange = null; OnUpdateSolutionCancel = null; - OnUpdateProjectConfigDone = null; - OnUpdateProjectConfigBegin = null; if (_cookie != 0) { From fb243ec19f1bb9c80ab7493cf4b6ab220ecdf827 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 29 Sep 2022 13:36:36 -0700 Subject: [PATCH 22/38] Remove unused events and method implementations --- .../InProcess/SolutionExplorerInProcess.cs | 72 ++----------------- 1 file changed, 7 insertions(+), 65 deletions(-) diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs index a2db2eeb4dfc1..a9c004480b3f5 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs @@ -559,7 +559,7 @@ private async Task WaitForBuildToFinishAsync(IVsOutputWindowPane buildOu using var solutionEvents = new UpdateSolutionEvents(buildManager); var buildCompleteTaskCompletionSource = new TaskCompletionSource(); - void HandleUpdateSolutionDone(bool succeeded, bool modified, bool canceled) => buildCompleteTaskCompletionSource.SetResult(succeeded); + void HandleUpdateSolutionDone() => buildCompleteTaskCompletionSource.SetResult(true); solutionEvents.OnUpdateSolutionDone += HandleUpdateSolutionDone; try { @@ -712,22 +712,9 @@ internal sealed class UpdateSolutionEvents : IVsUpdateSolutionEvents, IDisposabl private uint _cookie; private readonly IVsSolutionBuildManager2 _solutionBuildManager; - internal delegate void UpdateSolutionDoneEvent(bool succeeded, bool modified, bool canceled); - - internal delegate void UpdateSolutionBeginEvent(ref bool cancel); - - internal delegate void UpdateSolutionStartUpdateEvent(ref bool cancel); - + internal delegate void UpdateSolutionDoneEvent(); public event UpdateSolutionDoneEvent? OnUpdateSolutionDone; - public event UpdateSolutionBeginEvent? OnUpdateSolutionBegin; - - public event UpdateSolutionStartUpdateEvent? OnUpdateSolutionStartUpdate; - - public event Action? OnActiveProjectConfigurationChange; - - public event Action? OnUpdateSolutionCancel; - internal UpdateSolutionEvents(IVsSolutionBuildManager2 solutionBuildManager) { ThreadHelper.ThrowIfNotOnUIThread(); @@ -736,55 +723,14 @@ internal UpdateSolutionEvents(IVsSolutionBuildManager2 solutionBuildManager) ErrorHandler.ThrowOnFailure(solutionBuildManager.AdviseUpdateSolutionEvents(this, out _cookie)); } - int IVsUpdateSolutionEvents.UpdateSolution_Begin(ref int pfCancelUpdate) - { - var cancel = false; - OnUpdateSolutionBegin?.Invoke(ref cancel); - if (cancel) - { - pfCancelUpdate = 1; - } - - return 0; - } + int IVsUpdateSolutionEvents.UpdateSolution_Begin(ref int pfCancelUpdate) => 0; + int IVsUpdateSolutionEvents.UpdateSolution_StartUpdate(ref int pfCancelUpdate) => 0; + int IVsUpdateSolutionEvents.UpdateSolution_Cancel() => 0; + int IVsUpdateSolutionEvents.OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy) => 0; int IVsUpdateSolutionEvents.UpdateSolution_Done(int fSucceeded, int fModified, int fCancelCommand) { - OnUpdateSolutionDone?.Invoke(fSucceeded != 0, fModified != 0, fCancelCommand != 0); - return 0; - } - - int IVsUpdateSolutionEvents.UpdateSolution_StartUpdate(ref int pfCancelUpdate) - { - return UpdateSolution_StartUpdate(ref pfCancelUpdate); - } - - int IVsUpdateSolutionEvents.UpdateSolution_Cancel() - { - OnUpdateSolutionCancel?.Invoke(); - return 0; - } - - int IVsUpdateSolutionEvents.OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy) - { - return OnActiveProjectCfgChange(pIVsHierarchy); - } - - private int UpdateSolution_StartUpdate(ref int pfCancelUpdate) - { - var cancel = false; - OnUpdateSolutionStartUpdate?.Invoke(ref cancel); - if (cancel) - { - pfCancelUpdate = 1; - } - - return 0; - } - - private int OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy) - { - OnActiveProjectConfigurationChange?.Invoke(); + OnUpdateSolutionDone?.Invoke(); return 0; } @@ -793,10 +739,6 @@ void IDisposable.Dispose() ThreadHelper.ThrowIfNotOnUIThread(); OnUpdateSolutionDone = null; - OnUpdateSolutionBegin = null; - OnUpdateSolutionStartUpdate = null; - OnActiveProjectConfigurationChange = null; - OnUpdateSolutionCancel = null; if (_cookie != 0) { From 6ec9c3e95c55f733a4e0733204c8439defa91e6a Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 29 Sep 2022 13:40:12 -0700 Subject: [PATCH 23/38] Remove unused using directives --- .../New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs index a9c004480b3f5..81134ca732f28 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs @@ -31,8 +31,6 @@ using Reference5 = VSLangProj110.Reference5; using Reference2 = VSLangProj2.Reference2; using VSProject3 = VSLangProj140.VSProject3; -using Microsoft.VisualStudio.LanguageServices.Interactive; -using Microsoft.CodeAnalysis.AddFileBanner; namespace Microsoft.VisualStudio.Extensibility.Testing { From 7cc24dfc47948fb5296ba4cbb03105ed71546b26 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 29 Sep 2022 13:42:20 -0700 Subject: [PATCH 24/38] Remove unnecessary delegate --- .../InProcess/SolutionExplorerInProcess.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs index 81134ca732f28..5858630b816fb 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs @@ -710,8 +710,7 @@ internal sealed class UpdateSolutionEvents : IVsUpdateSolutionEvents, IDisposabl private uint _cookie; private readonly IVsSolutionBuildManager2 _solutionBuildManager; - internal delegate void UpdateSolutionDoneEvent(); - public event UpdateSolutionDoneEvent? OnUpdateSolutionDone; + public event Action? OnUpdateSolutionDone; internal UpdateSolutionEvents(IVsSolutionBuildManager2 solutionBuildManager) { From fbd833497eecf152a776d9db022840cb37ecb5b2 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 29 Sep 2022 13:49:38 -0700 Subject: [PATCH 25/38] Lines are zero based. --- .../New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs index 5858630b816fb..be88acb56e978 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs @@ -580,7 +580,7 @@ private async Task WaitForBuildToFinishAsync(IVsOutputWindowPane buildOu } // Find the build summary line - for (var index = lines.Count - 1; index > 0; index--) + for (var index = lines.Count - 1; index >= 0; index--) { var lineText = lines[index].Extent.GetText(); if (lineText.StartsWith("========== Build:")) From 49b6c6fcc26626fd939437cc346cdc69483adcbb Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 29 Sep 2022 15:51:53 -0700 Subject: [PATCH 26/38] Return E_NOTIMPL --- .../InProcess/SolutionExplorerInProcess.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs index be88acb56e978..24abce45f53cc 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. @@ -720,10 +720,10 @@ internal UpdateSolutionEvents(IVsSolutionBuildManager2 solutionBuildManager) ErrorHandler.ThrowOnFailure(solutionBuildManager.AdviseUpdateSolutionEvents(this, out _cookie)); } - int IVsUpdateSolutionEvents.UpdateSolution_Begin(ref int pfCancelUpdate) => 0; - int IVsUpdateSolutionEvents.UpdateSolution_StartUpdate(ref int pfCancelUpdate) => 0; - int IVsUpdateSolutionEvents.UpdateSolution_Cancel() => 0; - int IVsUpdateSolutionEvents.OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy) => 0; + int IVsUpdateSolutionEvents.UpdateSolution_Begin(ref int pfCancelUpdate) => VSConstants.E_NOTIMPL; + int IVsUpdateSolutionEvents.UpdateSolution_StartUpdate(ref int pfCancelUpdate) => VSConstants.E_NOTIMPL; + int IVsUpdateSolutionEvents.UpdateSolution_Cancel() => VSConstants.E_NOTIMPL; + int IVsUpdateSolutionEvents.OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy) => VSConstants.E_NOTIMPL; int IVsUpdateSolutionEvents.UpdateSolution_Done(int fSucceeded, int fModified, int fCancelCommand) { From b2b7040d56a960691facc1d1c7ab01933d2e66d8 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 29 Sep 2022 15:52:20 -0700 Subject: [PATCH 27/38] Start build after we have hooked build events. --- .../CSharp/CSharpBuild.cs | 2 +- .../CSharp/CSharpErrorListCommon.cs | 2 +- .../InProcess/SolutionExplorerInProcess.cs | 27 ++++++------------- .../VisualBasic/BasicErrorListCommon.cs | 2 +- 4 files changed, 11 insertions(+), 22 deletions(-) diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpBuild.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpBuild.cs index 9134b15b0b21a..a3468dee04f89 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpBuild.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpBuild.cs @@ -42,7 +42,7 @@ static void Main(string[] args) await TestServices.Editor.SetTextAsync(editorText, HangMitigatingCancellationToken); - var buildSummary = await TestServices.SolutionExplorer.BuildSolutionAsync(waitForBuildToFinish: true, HangMitigatingCancellationToken); + var buildSummary = await TestServices.SolutionExplorer.BuildSolutionAndWaitAsync(HangMitigatingCancellationToken); Assert.Equal("========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========", buildSummary); await TestServices.ErrorList.ShowBuildErrorsAsync(HangMitigatingCancellationToken); diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpErrorListCommon.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpErrorListCommon.cs index 6d267d1a55f69..63d2e9c153b13 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpErrorListCommon.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpErrorListCommon.cs @@ -52,7 +52,7 @@ static void Main(string[] args) var target = await TestServices.ErrorList.NavigateToErrorListItemAsync(0, isPreview: false, shouldActivate: true, HangMitigatingCancellationToken); Assert.Equal(expectedContents[0], target); Assert.Equal(25, await TestServices.Editor.GetCaretPositionAsync(HangMitigatingCancellationToken)); - await TestServices.SolutionExplorer.BuildSolutionAsync(waitForBuildToFinish: true, HangMitigatingCancellationToken); + await TestServices.SolutionExplorer.BuildSolutionAndWaitAsync(HangMitigatingCancellationToken); await TestServices.ErrorList.ShowErrorListAsync(HangMitigatingCancellationToken); await TestServices.Workspace.WaitForAllAsyncOperationsAsync(new[] { FeatureAttribute.Workspace, FeatureAttribute.SolutionCrawler, FeatureAttribute.DiagnosticService, FeatureAttribute.ErrorSquiggles, FeatureAttribute.ErrorList }, HangMitigatingCancellationToken); actualContents = await TestServices.ErrorList.GetErrorsAsync(HangMitigatingCancellationToken); diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs index 24abce45f53cc..c7957a0cc75ed 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. @@ -519,27 +519,11 @@ public async Task GetFileContentsAsync(string projectName, string relati /// /// Otherwise, this method does not wait for the build to complete and returns . /// - public async Task BuildSolutionAsync(bool waitForBuildToFinish, CancellationToken cancellationToken) + public async Task BuildSolutionAsync(CancellationToken cancellationToken) { await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); - var buildOutputWindowPane = await GetBuildOutputWindowPaneAsync(cancellationToken); - buildOutputWindowPane.Clear(); - await TestServices.Shell.ExecuteCommandAsync(VSConstants.VSStd97CmdID.BuildSln, cancellationToken); - if (waitForBuildToFinish) - { - return await WaitForBuildToFinishAsync(buildOutputWindowPane, cancellationToken); - } - - return null; - } - - /// - public async Task WaitForBuildToFinishAsync(CancellationToken cancellationToken) - { - var buildOutputWindowPane = await GetBuildOutputWindowPaneAsync(cancellationToken); - return await WaitForBuildToFinishAsync(buildOutputWindowPane, cancellationToken); } /// @@ -549,10 +533,13 @@ public async Task WaitForBuildToFinishAsync(CancellationToken cancellati /// ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ========== /// /// - private async Task WaitForBuildToFinishAsync(IVsOutputWindowPane buildOutputWindowPane, CancellationToken cancellationToken) + public async Task BuildSolutionAndWaitAsync(CancellationToken cancellationToken) { await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); + var buildOutputWindowPane = await GetBuildOutputWindowPaneAsync(cancellationToken); + buildOutputWindowPane.Clear(); + var buildManager = await GetRequiredGlobalServiceAsync(cancellationToken); using var solutionEvents = new UpdateSolutionEvents(buildManager); var buildCompleteTaskCompletionSource = new TaskCompletionSource(); @@ -561,6 +548,8 @@ private async Task WaitForBuildToFinishAsync(IVsOutputWindowPane buildOu solutionEvents.OnUpdateSolutionDone += HandleUpdateSolutionDone; try { + await TestServices.Shell.ExecuteCommandAsync(VSConstants.VSStd97CmdID.BuildSln, cancellationToken); + await buildCompleteTaskCompletionSource.Task; } finally diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/VisualBasic/BasicErrorListCommon.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/VisualBasic/BasicErrorListCommon.cs index 4c17f406a807a..06976ba39a623 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/VisualBasic/BasicErrorListCommon.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/VisualBasic/BasicErrorListCommon.cs @@ -51,7 +51,7 @@ End Module await TestServices.ErrorList.NavigateToErrorListItemAsync(0, isPreview: false, shouldActivate: true, HangMitigatingCancellationToken); await TestServices.EditorVerifier.CaretPositionAsync(43, HangMitigatingCancellationToken); - await TestServices.SolutionExplorer.BuildSolutionAsync(waitForBuildToFinish: true, HangMitigatingCancellationToken); + await TestServices.SolutionExplorer.BuildSolutionAndWaitAsync(HangMitigatingCancellationToken); await TestServices.ErrorList.ShowErrorListAsync(HangMitigatingCancellationToken); await TestServices.Workspace.WaitForAllAsyncOperationsAsync(new[] { FeatureAttribute.Workspace, FeatureAttribute.SolutionCrawler, FeatureAttribute.DiagnosticService, FeatureAttribute.ErrorSquiggles, FeatureAttribute.ErrorList }, HangMitigatingCancellationToken); actualContents = await TestServices.ErrorList.GetErrorsAsync(HangMitigatingCancellationToken); From 047b37dea34f861d405d6a5218a27b7ed8fa0863 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 29 Sep 2022 16:23:09 -0700 Subject: [PATCH 28/38] Remove unused test method --- .../InProcess/SolutionExplorerInProcess.cs | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs index c7957a0cc75ed..c84ffc4006c57 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs @@ -510,22 +510,6 @@ public async Task GetFileContentsAsync(string projectName, string relati return (solutionDirectory, solutionFileFullPath, userOptionsFile); } - /// - /// If is , returns the build status line, which generally looks something like this: - /// - /// - /// ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ========== - /// - /// - /// Otherwise, this method does not wait for the build to complete and returns . - /// - public async Task BuildSolutionAsync(CancellationToken cancellationToken) - { - await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); - - await TestServices.Shell.ExecuteCommandAsync(VSConstants.VSStd97CmdID.BuildSln, cancellationToken); - } - /// /// The summary line for the build, which generally looks something like this: /// From d75976228c644e23cc5193fc019bef2bcad1d011 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 29 Sep 2022 10:43:03 -0700 Subject: [PATCH 29/38] Listen to build manager events to know when build is complete --- .../InProcess/SolutionExplorerInProcess.cs | 151 +++++++++++++++--- 1 file changed, 133 insertions(+), 18 deletions(-) diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs index c84ffc4006c57..14e9e7a490eee 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs @@ -31,6 +31,7 @@ using Reference5 = VSLangProj110.Reference5; using Reference2 = VSLangProj2.Reference2; using VSProject3 = VSLangProj140.VSProject3; +using Microsoft.VisualStudio.LanguageServices.Interactive; namespace Microsoft.VisualStudio.Extensibility.Testing { @@ -521,20 +522,15 @@ public async Task BuildSolutionAndWaitAsync(CancellationToken cancellati { await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); - var buildOutputWindowPane = await GetBuildOutputWindowPaneAsync(cancellationToken); - buildOutputWindowPane.Clear(); - var buildManager = await GetRequiredGlobalServiceAsync(cancellationToken); + using var semaphore = new SemaphoreSlim(1); using var solutionEvents = new UpdateSolutionEvents(buildManager); - var buildCompleteTaskCompletionSource = new TaskCompletionSource(); - - void HandleUpdateSolutionDone() => buildCompleteTaskCompletionSource.SetResult(true); + await semaphore.WaitAsync(); + void HandleUpdateSolutionDone(bool succeeded, bool modified, bool canceled) => semaphore.Release(); solutionEvents.OnUpdateSolutionDone += HandleUpdateSolutionDone; try { - await TestServices.Shell.ExecuteCommandAsync(VSConstants.VSStd97CmdID.BuildSln, cancellationToken); - - await buildCompleteTaskCompletionSource.Task; + await semaphore.WaitAsync(); } finally { @@ -544,7 +540,11 @@ public async Task BuildSolutionAndWaitAsync(CancellationToken cancellati // Force the error list to update ErrorHandler.ThrowOnFailure(buildOutputWindowPane.FlushToTaskList()); - var textView = (IVsTextView)buildOutputWindowPane; + if (buildOutputWindowPane is not IVsTextView textView) + { + throw new InvalidOperationException($"{nameof(IVsOutputWindowPane)} should implement {nameof(IVsTextView)}"); + } + var wpfTextViewHost = await textView.GetTextViewHostAsync(JoinableTaskFactory, cancellationToken); var lines = wpfTextViewHost.TextView.TextViewLines; if (lines.Count < 1) @@ -553,7 +553,7 @@ public async Task BuildSolutionAndWaitAsync(CancellationToken cancellati } // Find the build summary line - for (var index = lines.Count - 1; index >= 0; index--) + for (int index = lines.Count - 1; index > 0; index--) { var lineText = lines[index].Extent.GetText(); if (lineText.StartsWith("========== Build:")) @@ -678,12 +678,34 @@ private static string CreateTemporaryPath() } } - internal sealed class UpdateSolutionEvents : IVsUpdateSolutionEvents, IDisposable + internal sealed class UpdateSolutionEvents : IVsUpdateSolutionEvents, IVsUpdateSolutionEvents2, IDisposable { private uint _cookie; private readonly IVsSolutionBuildManager2 _solutionBuildManager; - public event Action? OnUpdateSolutionDone; + internal delegate void UpdateSolutionDoneEvent(bool succeeded, bool modified, bool canceled); + + internal delegate void UpdateSolutionBeginEvent(ref bool cancel); + + internal delegate void UpdateSolutionStartUpdateEvent(ref bool cancel); + + internal delegate void UpdateProjectConfigDoneEvent(IVsHierarchy projectHierarchy, IVsCfg projectConfig, int success); + + internal delegate void UpdateProjectConfigBeginEvent(IVsHierarchy projectHierarchy, IVsCfg projectConfig); + + public event UpdateSolutionDoneEvent? OnUpdateSolutionDone; + + public event UpdateSolutionBeginEvent? OnUpdateSolutionBegin; + + public event UpdateSolutionStartUpdateEvent? OnUpdateSolutionStartUpdate; + + public event Action? OnActiveProjectConfigurationChange; + + public event Action? OnUpdateSolutionCancel; + + public event UpdateProjectConfigDoneEvent? OnUpdateProjectConfigDone; + + public event UpdateProjectConfigBeginEvent? OnUpdateProjectConfigBegin; internal UpdateSolutionEvents(IVsSolutionBuildManager2 solutionBuildManager) { @@ -693,14 +715,101 @@ internal UpdateSolutionEvents(IVsSolutionBuildManager2 solutionBuildManager) ErrorHandler.ThrowOnFailure(solutionBuildManager.AdviseUpdateSolutionEvents(this, out _cookie)); } - int IVsUpdateSolutionEvents.UpdateSolution_Begin(ref int pfCancelUpdate) => VSConstants.E_NOTIMPL; - int IVsUpdateSolutionEvents.UpdateSolution_StartUpdate(ref int pfCancelUpdate) => VSConstants.E_NOTIMPL; - int IVsUpdateSolutionEvents.UpdateSolution_Cancel() => VSConstants.E_NOTIMPL; - int IVsUpdateSolutionEvents.OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy) => VSConstants.E_NOTIMPL; + int IVsUpdateSolutionEvents.UpdateSolution_Begin(ref int pfCancelUpdate) + { + var cancel = false; + OnUpdateSolutionBegin?.Invoke(ref cancel); + if (cancel) + { + pfCancelUpdate = 1; + } + + return 0; + } int IVsUpdateSolutionEvents.UpdateSolution_Done(int fSucceeded, int fModified, int fCancelCommand) { - OnUpdateSolutionDone?.Invoke(); + OnUpdateSolutionDone?.Invoke(fSucceeded != 0, fModified != 0, fCancelCommand != 0); + return 0; + } + + int IVsUpdateSolutionEvents.UpdateSolution_StartUpdate(ref int pfCancelUpdate) + { + return UpdateSolution_StartUpdate(ref pfCancelUpdate); + } + + int IVsUpdateSolutionEvents.UpdateSolution_Cancel() + { + OnUpdateSolutionCancel?.Invoke(); + return 0; + } + + int IVsUpdateSolutionEvents.OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy) + { + return OnActiveProjectCfgChange(pIVsHierarchy); + } + + int IVsUpdateSolutionEvents2.UpdateSolution_Begin(ref int pfCancelUpdate) + { + var cancel = false; + OnUpdateSolutionBegin?.Invoke(ref cancel); + if (cancel) + { + pfCancelUpdate = 1; + } + + return 0; + } + + int IVsUpdateSolutionEvents2.UpdateSolution_Done(int fSucceeded, int fModified, int fCancelCommand) + { + OnUpdateSolutionDone?.Invoke(fSucceeded != 0, fModified != 0, fCancelCommand != 0); + return 0; + } + + int IVsUpdateSolutionEvents2.UpdateSolution_StartUpdate(ref int pfCancelUpdate) + { + return UpdateSolution_StartUpdate(ref pfCancelUpdate); + } + + int IVsUpdateSolutionEvents2.UpdateSolution_Cancel() + { + OnUpdateSolutionCancel?.Invoke(); + return 0; + } + + int IVsUpdateSolutionEvents2.OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy) + { + return OnActiveProjectCfgChange(pIVsHierarchy); + } + + int IVsUpdateSolutionEvents2.UpdateProjectCfg_Begin(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, ref int pfCancel) + { + OnUpdateProjectConfigBegin?.Invoke(pHierProj, pCfgProj); + return 0; + } + + int IVsUpdateSolutionEvents2.UpdateProjectCfg_Done(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, int fSuccess, int fCancel) + { + OnUpdateProjectConfigDone?.Invoke(pHierProj, pCfgProj, fSuccess); + return 0; + } + + private int UpdateSolution_StartUpdate(ref int pfCancelUpdate) + { + var cancel = false; + OnUpdateSolutionStartUpdate?.Invoke(ref cancel); + if (cancel) + { + pfCancelUpdate = 1; + } + + return 0; + } + + private int OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy) + { + OnActiveProjectConfigurationChange?.Invoke(); return 0; } @@ -709,6 +818,12 @@ void IDisposable.Dispose() ThreadHelper.ThrowIfNotOnUIThread(); OnUpdateSolutionDone = null; + OnUpdateSolutionBegin = null; + OnUpdateSolutionStartUpdate = null; + OnActiveProjectConfigurationChange = null; + OnUpdateSolutionCancel = null; + OnUpdateProjectConfigDone = null; + OnUpdateProjectConfigBegin = null; if (_cookie != 0) { From ddda30a74254a556e530b99266acc239bbb4c77a Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 29 Sep 2022 11:19:42 -0700 Subject: [PATCH 30/38] Remove unused interface implementation --- .../InProcess/SolutionExplorerInProcess.cs | 75 ++----------------- 1 file changed, 8 insertions(+), 67 deletions(-) diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs index 14e9e7a490eee..7cd2fd8a8915a 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs @@ -32,6 +32,7 @@ using Reference2 = VSLangProj2.Reference2; using VSProject3 = VSLangProj140.VSProject3; using Microsoft.VisualStudio.LanguageServices.Interactive; +using Microsoft.CodeAnalysis.AddFileBanner; namespace Microsoft.VisualStudio.Extensibility.Testing { @@ -523,14 +524,14 @@ public async Task BuildSolutionAndWaitAsync(CancellationToken cancellati await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); var buildManager = await GetRequiredGlobalServiceAsync(cancellationToken); - using var semaphore = new SemaphoreSlim(1); using var solutionEvents = new UpdateSolutionEvents(buildManager); - await semaphore.WaitAsync(); - void HandleUpdateSolutionDone(bool succeeded, bool modified, bool canceled) => semaphore.Release(); + var buildCompleteTaskCompletionSource = new TaskCompletionSource(); + + void HandleUpdateSolutionDone(bool succeeded, bool modified, bool canceled) => buildCompleteTaskCompletionSource.SetResult(succeeded); solutionEvents.OnUpdateSolutionDone += HandleUpdateSolutionDone; try { - await semaphore.WaitAsync(); + await buildCompleteTaskCompletionSource.Task; } finally { @@ -540,11 +541,7 @@ public async Task BuildSolutionAndWaitAsync(CancellationToken cancellati // Force the error list to update ErrorHandler.ThrowOnFailure(buildOutputWindowPane.FlushToTaskList()); - if (buildOutputWindowPane is not IVsTextView textView) - { - throw new InvalidOperationException($"{nameof(IVsOutputWindowPane)} should implement {nameof(IVsTextView)}"); - } - + var textView = (IVsTextView)buildOutputWindowPane; var wpfTextViewHost = await textView.GetTextViewHostAsync(JoinableTaskFactory, cancellationToken); var lines = wpfTextViewHost.TextView.TextViewLines; if (lines.Count < 1) @@ -553,7 +550,7 @@ public async Task BuildSolutionAndWaitAsync(CancellationToken cancellati } // Find the build summary line - for (int index = lines.Count - 1; index > 0; index--) + for (var index = lines.Count - 1; index > 0; index--) { var lineText = lines[index].Extent.GetText(); if (lineText.StartsWith("========== Build:")) @@ -678,7 +675,7 @@ private static string CreateTemporaryPath() } } - internal sealed class UpdateSolutionEvents : IVsUpdateSolutionEvents, IVsUpdateSolutionEvents2, IDisposable + internal sealed class UpdateSolutionEvents : IVsUpdateSolutionEvents, IDisposable { private uint _cookie; private readonly IVsSolutionBuildManager2 _solutionBuildManager; @@ -689,10 +686,6 @@ internal sealed class UpdateSolutionEvents : IVsUpdateSolutionEvents, IVsUpdateS internal delegate void UpdateSolutionStartUpdateEvent(ref bool cancel); - internal delegate void UpdateProjectConfigDoneEvent(IVsHierarchy projectHierarchy, IVsCfg projectConfig, int success); - - internal delegate void UpdateProjectConfigBeginEvent(IVsHierarchy projectHierarchy, IVsCfg projectConfig); - public event UpdateSolutionDoneEvent? OnUpdateSolutionDone; public event UpdateSolutionBeginEvent? OnUpdateSolutionBegin; @@ -703,10 +696,6 @@ internal sealed class UpdateSolutionEvents : IVsUpdateSolutionEvents, IVsUpdateS public event Action? OnUpdateSolutionCancel; - public event UpdateProjectConfigDoneEvent? OnUpdateProjectConfigDone; - - public event UpdateProjectConfigBeginEvent? OnUpdateProjectConfigBegin; - internal UpdateSolutionEvents(IVsSolutionBuildManager2 solutionBuildManager) { ThreadHelper.ThrowIfNotOnUIThread(); @@ -749,52 +738,6 @@ int IVsUpdateSolutionEvents.OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy) return OnActiveProjectCfgChange(pIVsHierarchy); } - int IVsUpdateSolutionEvents2.UpdateSolution_Begin(ref int pfCancelUpdate) - { - var cancel = false; - OnUpdateSolutionBegin?.Invoke(ref cancel); - if (cancel) - { - pfCancelUpdate = 1; - } - - return 0; - } - - int IVsUpdateSolutionEvents2.UpdateSolution_Done(int fSucceeded, int fModified, int fCancelCommand) - { - OnUpdateSolutionDone?.Invoke(fSucceeded != 0, fModified != 0, fCancelCommand != 0); - return 0; - } - - int IVsUpdateSolutionEvents2.UpdateSolution_StartUpdate(ref int pfCancelUpdate) - { - return UpdateSolution_StartUpdate(ref pfCancelUpdate); - } - - int IVsUpdateSolutionEvents2.UpdateSolution_Cancel() - { - OnUpdateSolutionCancel?.Invoke(); - return 0; - } - - int IVsUpdateSolutionEvents2.OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy) - { - return OnActiveProjectCfgChange(pIVsHierarchy); - } - - int IVsUpdateSolutionEvents2.UpdateProjectCfg_Begin(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, ref int pfCancel) - { - OnUpdateProjectConfigBegin?.Invoke(pHierProj, pCfgProj); - return 0; - } - - int IVsUpdateSolutionEvents2.UpdateProjectCfg_Done(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, int fSuccess, int fCancel) - { - OnUpdateProjectConfigDone?.Invoke(pHierProj, pCfgProj, fSuccess); - return 0; - } - private int UpdateSolution_StartUpdate(ref int pfCancelUpdate) { var cancel = false; @@ -822,8 +765,6 @@ void IDisposable.Dispose() OnUpdateSolutionStartUpdate = null; OnActiveProjectConfigurationChange = null; OnUpdateSolutionCancel = null; - OnUpdateProjectConfigDone = null; - OnUpdateProjectConfigBegin = null; if (_cookie != 0) { From 00a48bdde0fd59ff159b5864a3038fb4aedf2555 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 29 Sep 2022 13:36:36 -0700 Subject: [PATCH 31/38] Remove unused events and method implementations --- .../InProcess/SolutionExplorerInProcess.cs | 72 ++----------------- 1 file changed, 7 insertions(+), 65 deletions(-) diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs index 7cd2fd8a8915a..36a2927849728 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs @@ -527,7 +527,7 @@ public async Task BuildSolutionAndWaitAsync(CancellationToken cancellati using var solutionEvents = new UpdateSolutionEvents(buildManager); var buildCompleteTaskCompletionSource = new TaskCompletionSource(); - void HandleUpdateSolutionDone(bool succeeded, bool modified, bool canceled) => buildCompleteTaskCompletionSource.SetResult(succeeded); + void HandleUpdateSolutionDone() => buildCompleteTaskCompletionSource.SetResult(true); solutionEvents.OnUpdateSolutionDone += HandleUpdateSolutionDone; try { @@ -680,22 +680,9 @@ internal sealed class UpdateSolutionEvents : IVsUpdateSolutionEvents, IDisposabl private uint _cookie; private readonly IVsSolutionBuildManager2 _solutionBuildManager; - internal delegate void UpdateSolutionDoneEvent(bool succeeded, bool modified, bool canceled); - - internal delegate void UpdateSolutionBeginEvent(ref bool cancel); - - internal delegate void UpdateSolutionStartUpdateEvent(ref bool cancel); - + internal delegate void UpdateSolutionDoneEvent(); public event UpdateSolutionDoneEvent? OnUpdateSolutionDone; - public event UpdateSolutionBeginEvent? OnUpdateSolutionBegin; - - public event UpdateSolutionStartUpdateEvent? OnUpdateSolutionStartUpdate; - - public event Action? OnActiveProjectConfigurationChange; - - public event Action? OnUpdateSolutionCancel; - internal UpdateSolutionEvents(IVsSolutionBuildManager2 solutionBuildManager) { ThreadHelper.ThrowIfNotOnUIThread(); @@ -704,55 +691,14 @@ internal UpdateSolutionEvents(IVsSolutionBuildManager2 solutionBuildManager) ErrorHandler.ThrowOnFailure(solutionBuildManager.AdviseUpdateSolutionEvents(this, out _cookie)); } - int IVsUpdateSolutionEvents.UpdateSolution_Begin(ref int pfCancelUpdate) - { - var cancel = false; - OnUpdateSolutionBegin?.Invoke(ref cancel); - if (cancel) - { - pfCancelUpdate = 1; - } - - return 0; - } + int IVsUpdateSolutionEvents.UpdateSolution_Begin(ref int pfCancelUpdate) => 0; + int IVsUpdateSolutionEvents.UpdateSolution_StartUpdate(ref int pfCancelUpdate) => 0; + int IVsUpdateSolutionEvents.UpdateSolution_Cancel() => 0; + int IVsUpdateSolutionEvents.OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy) => 0; int IVsUpdateSolutionEvents.UpdateSolution_Done(int fSucceeded, int fModified, int fCancelCommand) { - OnUpdateSolutionDone?.Invoke(fSucceeded != 0, fModified != 0, fCancelCommand != 0); - return 0; - } - - int IVsUpdateSolutionEvents.UpdateSolution_StartUpdate(ref int pfCancelUpdate) - { - return UpdateSolution_StartUpdate(ref pfCancelUpdate); - } - - int IVsUpdateSolutionEvents.UpdateSolution_Cancel() - { - OnUpdateSolutionCancel?.Invoke(); - return 0; - } - - int IVsUpdateSolutionEvents.OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy) - { - return OnActiveProjectCfgChange(pIVsHierarchy); - } - - private int UpdateSolution_StartUpdate(ref int pfCancelUpdate) - { - var cancel = false; - OnUpdateSolutionStartUpdate?.Invoke(ref cancel); - if (cancel) - { - pfCancelUpdate = 1; - } - - return 0; - } - - private int OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy) - { - OnActiveProjectConfigurationChange?.Invoke(); + OnUpdateSolutionDone?.Invoke(); return 0; } @@ -761,10 +707,6 @@ void IDisposable.Dispose() ThreadHelper.ThrowIfNotOnUIThread(); OnUpdateSolutionDone = null; - OnUpdateSolutionBegin = null; - OnUpdateSolutionStartUpdate = null; - OnActiveProjectConfigurationChange = null; - OnUpdateSolutionCancel = null; if (_cookie != 0) { From bc10eb9c7f9d6e155f1a7cc22e0803f36caf0b95 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 29 Sep 2022 13:40:12 -0700 Subject: [PATCH 32/38] Remove unused using directives --- .../New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs index 36a2927849728..b60400ffcbf49 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs @@ -31,8 +31,6 @@ using Reference5 = VSLangProj110.Reference5; using Reference2 = VSLangProj2.Reference2; using VSProject3 = VSLangProj140.VSProject3; -using Microsoft.VisualStudio.LanguageServices.Interactive; -using Microsoft.CodeAnalysis.AddFileBanner; namespace Microsoft.VisualStudio.Extensibility.Testing { From fe35719234823beac45aa4d0a1558d33b5cd8efe Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 29 Sep 2022 13:42:20 -0700 Subject: [PATCH 33/38] Remove unnecessary delegate --- .../InProcess/SolutionExplorerInProcess.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs index b60400ffcbf49..2f1b698664cb3 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs @@ -678,8 +678,7 @@ internal sealed class UpdateSolutionEvents : IVsUpdateSolutionEvents, IDisposabl private uint _cookie; private readonly IVsSolutionBuildManager2 _solutionBuildManager; - internal delegate void UpdateSolutionDoneEvent(); - public event UpdateSolutionDoneEvent? OnUpdateSolutionDone; + public event Action? OnUpdateSolutionDone; internal UpdateSolutionEvents(IVsSolutionBuildManager2 solutionBuildManager) { From 0ca893873231dfc5a23512c3403c678e2156997c Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 29 Sep 2022 13:49:38 -0700 Subject: [PATCH 34/38] Lines are zero based. --- .../New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs index 2f1b698664cb3..76d6a349642a7 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs @@ -548,7 +548,7 @@ public async Task BuildSolutionAndWaitAsync(CancellationToken cancellati } // Find the build summary line - for (var index = lines.Count - 1; index > 0; index--) + for (var index = lines.Count - 1; index >= 0; index--) { var lineText = lines[index].Extent.GetText(); if (lineText.StartsWith("========== Build:")) From 548ef904fc5eca5c6f9ce35dcdaa80b4a747c829 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 29 Sep 2022 15:51:53 -0700 Subject: [PATCH 35/38] Return E_NOTIMPL --- .../InProcess/SolutionExplorerInProcess.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs index 76d6a349642a7..bfb53da890f26 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. @@ -688,10 +688,10 @@ internal UpdateSolutionEvents(IVsSolutionBuildManager2 solutionBuildManager) ErrorHandler.ThrowOnFailure(solutionBuildManager.AdviseUpdateSolutionEvents(this, out _cookie)); } - int IVsUpdateSolutionEvents.UpdateSolution_Begin(ref int pfCancelUpdate) => 0; - int IVsUpdateSolutionEvents.UpdateSolution_StartUpdate(ref int pfCancelUpdate) => 0; - int IVsUpdateSolutionEvents.UpdateSolution_Cancel() => 0; - int IVsUpdateSolutionEvents.OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy) => 0; + int IVsUpdateSolutionEvents.UpdateSolution_Begin(ref int pfCancelUpdate) => VSConstants.E_NOTIMPL; + int IVsUpdateSolutionEvents.UpdateSolution_StartUpdate(ref int pfCancelUpdate) => VSConstants.E_NOTIMPL; + int IVsUpdateSolutionEvents.UpdateSolution_Cancel() => VSConstants.E_NOTIMPL; + int IVsUpdateSolutionEvents.OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy) => VSConstants.E_NOTIMPL; int IVsUpdateSolutionEvents.UpdateSolution_Done(int fSucceeded, int fModified, int fCancelCommand) { From fa32353a21a81bb4f1fa43ab7b3f6f4c694c3ee0 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 29 Sep 2022 15:52:20 -0700 Subject: [PATCH 36/38] Start build after we have hooked build events. --- .../InProcess/SolutionExplorerInProcess.cs | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs index bfb53da890f26..c7957a0cc75ed 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. @@ -510,6 +510,22 @@ public async Task GetFileContentsAsync(string projectName, string relati return (solutionDirectory, solutionFileFullPath, userOptionsFile); } + /// + /// If is , returns the build status line, which generally looks something like this: + /// + /// + /// ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ========== + /// + /// + /// Otherwise, this method does not wait for the build to complete and returns . + /// + public async Task BuildSolutionAsync(CancellationToken cancellationToken) + { + await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); + + await TestServices.Shell.ExecuteCommandAsync(VSConstants.VSStd97CmdID.BuildSln, cancellationToken); + } + /// /// The summary line for the build, which generally looks something like this: /// @@ -521,6 +537,9 @@ public async Task BuildSolutionAndWaitAsync(CancellationToken cancellati { await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); + var buildOutputWindowPane = await GetBuildOutputWindowPaneAsync(cancellationToken); + buildOutputWindowPane.Clear(); + var buildManager = await GetRequiredGlobalServiceAsync(cancellationToken); using var solutionEvents = new UpdateSolutionEvents(buildManager); var buildCompleteTaskCompletionSource = new TaskCompletionSource(); @@ -529,6 +548,8 @@ public async Task BuildSolutionAndWaitAsync(CancellationToken cancellati solutionEvents.OnUpdateSolutionDone += HandleUpdateSolutionDone; try { + await TestServices.Shell.ExecuteCommandAsync(VSConstants.VSStd97CmdID.BuildSln, cancellationToken); + await buildCompleteTaskCompletionSource.Task; } finally From 18e160fb74c3c783e14597a9c892ced345d00bbc Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 29 Sep 2022 16:23:09 -0700 Subject: [PATCH 37/38] Remove unused test method --- .../InProcess/SolutionExplorerInProcess.cs | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs index c7957a0cc75ed..c84ffc4006c57 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs @@ -510,22 +510,6 @@ public async Task GetFileContentsAsync(string projectName, string relati return (solutionDirectory, solutionFileFullPath, userOptionsFile); } - /// - /// If is , returns the build status line, which generally looks something like this: - /// - /// - /// ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ========== - /// - /// - /// Otherwise, this method does not wait for the build to complete and returns . - /// - public async Task BuildSolutionAsync(CancellationToken cancellationToken) - { - await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); - - await TestServices.Shell.ExecuteCommandAsync(VSConstants.VSStd97CmdID.BuildSln, cancellationToken); - } - /// /// The summary line for the build, which generally looks something like this: /// From 9b9bc5adbb7193a22cc0fa3ea4f8985d1f6af61a Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 3 Oct 2022 13:36:07 -0700 Subject: [PATCH 38/38] Update how we are getting active document filename --- .../CSharp/CSharpFindReferences.cs | 3 +-- .../CSharp/CSharpGoToDefinition.cs | 3 +-- .../CSharp/CSharpGoToImplementation.cs | 9 +++------ .../InProcess/EditorInProcess.cs | 9 --------- .../InProcess/ShellInProcess.cs | 15 +++++++++++++++ .../VisualBasic/BasicFindReferences.cs | 3 +-- .../VisualBasic/BasicGoToDefinition.cs | 3 +-- .../VisualBasic/BasicGoToImplementation.cs | 3 +-- 8 files changed, 23 insertions(+), 25 deletions(-) diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpFindReferences.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpFindReferences.cs index 44fd1e20ff7f3..d99c60b5f435d 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpFindReferences.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpFindReferences.cs @@ -76,8 +76,7 @@ void M() await WaitForNavigateAsync(HangMitigatingCancellationToken); // Assert we are in the right file now - var dirtyModifier = await TestServices.Editor.GetDirtyIndicatorAsync(HangMitigatingCancellationToken); - Assert.Equal($"Class1.cs{dirtyModifier}", await TestServices.Shell.GetActiveWindowCaptionAsync(HangMitigatingCancellationToken)); + Assert.Equal($"Class1.cs", await TestServices.Shell.GetActiveDocumentFileNameAsync(HangMitigatingCancellationToken)); Assert.Equal("Program", await TestServices.Editor.GetLineTextAfterCaretAsync(HangMitigatingCancellationToken)); } diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpGoToDefinition.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpGoToDefinition.cs index b111ed82f8f84..5450cc1fe636f 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpGoToDefinition.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpGoToDefinition.cs @@ -44,8 +44,7 @@ await TestServices.Editor.SetTextAsync( }", HangMitigatingCancellationToken); await TestServices.Editor.PlaceCaretAsync("SomeClass", charsOffset: 0, HangMitigatingCancellationToken); await TestServices.Editor.GoToDefinitionAsync(HangMitigatingCancellationToken); - var dirtyModifier = await TestServices.Editor.GetDirtyIndicatorAsync(HangMitigatingCancellationToken); - Assert.Equal($"FileDef.cs{dirtyModifier}", await TestServices.Shell.GetActiveWindowCaptionAsync(HangMitigatingCancellationToken)); + Assert.Equal($"FileDef.cs", await TestServices.Shell.GetActiveDocumentFileNameAsync(HangMitigatingCancellationToken)); await TestServices.EditorVerifier.TextContainsAsync(@"class SomeClass$$", assertCaretPosition: true, HangMitigatingCancellationToken); Assert.False(await TestServices.Shell.IsActiveTabProvisionalAsync(HangMitigatingCancellationToken)); } diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpGoToImplementation.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpGoToImplementation.cs index c7b3405f6ab82..f459519693391 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpGoToImplementation.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpGoToImplementation.cs @@ -69,8 +69,7 @@ await TestServices.Editor.SetTextAsync( identifierWithCaret = "$$Implementation"; } - var dirtyModifier = await TestServices.Editor.GetDirtyIndicatorAsync(HangMitigatingCancellationToken); - Assert.Equal($"FileImplementation.cs{dirtyModifier}", await TestServices.Shell.GetActiveWindowCaptionAsync(HangMitigatingCancellationToken)); + Assert.Equal($"FileImplementation.cs", await TestServices.Shell.GetActiveDocumentFileNameAsync(HangMitigatingCancellationToken)); await TestServices.EditorVerifier.TextContainsAsync($@"class {identifierWithCaret}", assertCaretPosition: true, HangMitigatingCancellationToken); Assert.False(await TestServices.Shell.IsActiveTabProvisionalAsync(HangMitigatingCancellationToken)); } @@ -174,8 +173,7 @@ public void SomeMethod() identifierWithCaret = "$$Implementation"; } - var dirtyModifier = await TestServices.Editor.GetDirtyIndicatorAsync(HangMitigatingCancellationToken); - Assert.Equal($"FileImplementation.cs{dirtyModifier}", await TestServices.Shell.GetActiveWindowCaptionAsync(HangMitigatingCancellationToken)); + Assert.Equal($"FileImplementation.cs", await TestServices.Shell.GetActiveDocumentFileNameAsync(HangMitigatingCancellationToken)); await TestServices.EditorVerifier.TextContainsAsync($@"class {identifierWithCaret} : IDisposable", assertCaretPosition: true, HangMitigatingCancellationToken); } @@ -223,8 +221,7 @@ void M() await TestServices.Editor.PlaceCaretAsync("Dispose", charsOffset: -1, HangMitigatingCancellationToken); // This one won't automatically navigate to the implementation - var dirtyModifier = await TestServices.Editor.GetDirtyIndicatorAsync(HangMitigatingCancellationToken); - Assert.Equal($"FileUsage.cs{dirtyModifier}", await TestServices.Shell.GetActiveWindowCaptionAsync(HangMitigatingCancellationToken)); + Assert.Equal($"FileUsage.cs", await TestServices.Shell.GetActiveDocumentFileNameAsync(HangMitigatingCancellationToken)); await TestServices.Editor.GoToImplementationAsync(HangMitigatingCancellationToken); Assert.Equal("'Dispose' implementations - Entire solution", await TestServices.Shell.GetActiveWindowCaptionAsync(HangMitigatingCancellationToken)); diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/EditorInProcess.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/EditorInProcess.cs index 6f965f3bf72b2..59a37bcbd869e 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/EditorInProcess.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/EditorInProcess.cs @@ -59,15 +59,6 @@ namespace Microsoft.VisualStudio.Extensibility.Testing { internal partial class EditorInProcess { - public async Task GetDirtyIndicatorAsync(CancellationToken cancellationToken) - { - var version = await TestServices.Shell.GetVersionAsync(cancellationToken); - if (version < Version.Parse("17.2.32224.407")) - return "*"; - - return " ⬤"; - } - public async Task WaitForEditorOperationsAsync(CancellationToken cancellationToken) { await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/ShellInProcess.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/ShellInProcess.cs index df42602e0c778..53a349c15c942 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/ShellInProcess.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/ShellInProcess.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using System.IO; using System.Linq; using System.Reflection; using System.Threading; @@ -10,6 +11,7 @@ using Microsoft.CodeAnalysis.UnitTests; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; +using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Threading; using IAsyncDisposable = System.IAsyncDisposable; @@ -36,6 +38,19 @@ internal async Task IsActiveTabProvisionalAsync(CancellationToken cancella return (bool)isProvisionalObject; } + public async Task GetActiveDocumentFileNameAsync(CancellationToken cancellationToken) + { + await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); + + var monitorSelection = await GetRequiredGlobalServiceAsync(cancellationToken); + ErrorHandler.ThrowOnFailure(monitorSelection.GetCurrentElementValue((uint)VSConstants.VSSELELEMID.SEID_WindowFrame, out var windowFrameObj)); + var windowFrame = (IVsWindowFrame)windowFrameObj; + + ErrorHandler.ThrowOnFailure(windowFrame.GetProperty((int)__VSFPROPID.VSFPROPID_pszMkDocument, out var documentPathObj)); + var documentPath = (string)documentPathObj; + return Path.GetFileName(documentPath); + } + internal async Task GetMainWindowAsync(CancellationToken cancellationToken) { await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/VisualBasic/BasicFindReferences.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/VisualBasic/BasicFindReferences.cs index f13cb9ed19b4b..6238425f6e69d 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/VisualBasic/BasicFindReferences.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/VisualBasic/BasicFindReferences.cs @@ -104,8 +104,7 @@ End Class await TestServices.FindReferencesWindow.NavigateToAsync(results[0], isPreview: false, shouldActivate: true, HangMitigatingCancellationToken); // Assert we are in the right file now - var dirtyModifier = await TestServices.Editor.GetDirtyIndicatorAsync(HangMitigatingCancellationToken); - Assert.Equal($"Class1.vb{dirtyModifier}", await TestServices.Shell.GetActiveWindowCaptionAsync(HangMitigatingCancellationToken)); + Assert.Equal($"Class1.vb", await TestServices.Shell.GetActiveDocumentFileNameAsync(HangMitigatingCancellationToken)); Assert.Equal("Alpha As Int32", await TestServices.Editor.GetLineTextAfterCaretAsync(HangMitigatingCancellationToken)); } } diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/VisualBasic/BasicGoToDefinition.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/VisualBasic/BasicGoToDefinition.cs index 47e2e1cfa08d1..ffe487f0de7d4 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/VisualBasic/BasicGoToDefinition.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/VisualBasic/BasicGoToDefinition.cs @@ -42,8 +42,7 @@ Dim gibberish As SomeClass End Class", HangMitigatingCancellationToken); await TestServices.Editor.PlaceCaretAsync("SomeClass", charsOffset: 0, HangMitigatingCancellationToken); await TestServices.Editor.GoToDefinitionAsync(HangMitigatingCancellationToken); - var dirtyModifier = await TestServices.Editor.GetDirtyIndicatorAsync(HangMitigatingCancellationToken); - Assert.Equal($"FileDef.vb{dirtyModifier}", await TestServices.Shell.GetActiveWindowCaptionAsync(HangMitigatingCancellationToken)); + Assert.Equal($"FileDef.vb", await TestServices.Shell.GetActiveDocumentFileNameAsync(HangMitigatingCancellationToken)); await TestServices.EditorVerifier.TextContainsAsync(@"Class SomeClass$$", assertCaretPosition: true, HangMitigatingCancellationToken); Assert.False(await TestServices.Shell.IsActiveTabProvisionalAsync(HangMitigatingCancellationToken)); } diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/VisualBasic/BasicGoToImplementation.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/VisualBasic/BasicGoToImplementation.cs index 3aa4bf382b783..30d9263969aef 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/VisualBasic/BasicGoToImplementation.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/VisualBasic/BasicGoToImplementation.cs @@ -66,8 +66,7 @@ await TestServices.Editor.SetTextAsync( identifierWithCaret = "$$Implementation"; } - var dirtyModifier = await TestServices.Editor.GetDirtyIndicatorAsync(HangMitigatingCancellationToken); - Assert.Equal($"FileImplementation.vb{dirtyModifier}", await TestServices.Shell.GetActiveWindowCaptionAsync(HangMitigatingCancellationToken)); + Assert.Equal($"FileImplementation.vb", await TestServices.Shell.GetActiveDocumentFileNameAsync(HangMitigatingCancellationToken)); await TestServices.EditorVerifier.TextContainsAsync($@"Class {identifierWithCaret}", assertCaretPosition: true); Assert.False(await TestServices.Shell.IsActiveTabProvisionalAsync(HangMitigatingCancellationToken)); }