Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Microsoft.Build.Traversal] Behavior is differrent, incorrect under net7.0 #412

Closed
heaths opened this issue Dec 2, 2022 · 4 comments
Closed
Labels
Duplicate This issue or pull request already exists
Projects

Comments

@heaths
Copy link
Member

heaths commented Dec 2, 2022

We are upgrading the Azure SDK for .NET to target net7.0 and net6.0 TFMs (and net461 on Windows). After changing our global.json to "7.0.100" and setting (effectively) <TargetFrameworks>net7.0;net6.0</TargetFrameworks>, I've noticed that loggers and properties are not being passed to inner builds.

Currently, we are using Microsoft.Build.Traversal 3.0.23 but even after upgrading to 3.2.0 it still doesn't work.

See Azure/azure-sdk-for-net#32814 (comment) for some details, but where we noticed this was that we pass /p:EnableSourceLink=false (and a bunch of other properties) but it was failing in our sparse checkout (known separate issue).

For example, in https://github.com/Azure/azure-sdk-for-net, this exact command line exhibits very different behaviors:

net6.0

dotnet test eng/service.proj --filter "(TestCategory!=Manually) & (TestCategory!=Live) & (Placeholder!=DefaultIgnoreMe)" --framework net6.0 --logger "trx;LogFileName=net6.0.trx" --logger:"console;verbosity=normal" -bl:"$PWD\msbuild.binlog" --blame-crash-dump-type full --blame-hang-dump-type full --blame-hang-timeout 100minutes /p:SDKType=all /p:ServiceDirectory=keyvault /p:IncludeSrc=false /p:IncludeSamples=false /p:IncludePerf=false /p:IncludeStress=false /p:RunApiCompat=false /p:InheritDocEnabled=false /p:Configuration=Debug /p:CollectCoverage=false /p:EnableSourceLink=false /p:ProjectListOverrideFile= /p:UseProjectReferenceToAzureClients=false

  1. Builds only packages under sdk/keyvault/ and those on which they depend e.g., sdk/core/Azure.Core/src/Azure.Core.csproj.
  2. Doesn't yield errors about invalid repo version (since we use sparse checkouts in some pipelines, which uses repo version 1, which causes Microsoft.Build.Tasks.Git to panic).

net7.0

exact same command line

  1. Builds all packages under sdk/ (because the filter property isn't being passed down).
  2. Yields errors because of the Microsoft.Build.Tasks.Git issue hopefully getting fixed in Add sparse checkout support dotnet/sourcelink#772.

I can't get you a binlog because however -bl is handled in inner builds (or even the outer?) is not taking effect: no binlog is generated under net7.0. It gets generated fine under net6.0 and does contain information about every package (filtered list) built.

@heaths
Copy link
Member Author

heaths commented Dec 2, 2022

Probably the fastest repro would be to:

git clone --no-checkout --filter=tree:0 https://github.com/Azure/azure-sdk-for-net
cd azure-sdk-for-net
git sparse-checkout init
git sparse-checkout set --no-cone '/*' '!/*/' '/eng'
git sparse-checkout add '/*' '!SessionRecords' '/sdk/appconfiguration/**/SessionRecords/*'
git remote add heaths https://github.com/heaths/azure-sdk-for-net
git fetch heaths issue32596
git checkout -b issue32596 FETCH_HEAD
dotnet test eng/service.proj --filter "(TestCategory!=Manually) & (TestCategory!=Live) & (Placeholder!=DefaultIgnoreMe)" --framework net6.0 --logger "trx;LogFileName=net6.0.trx" --logger:"console;verbosity=normal" -bl:msbuild.binlog --blame-crash-dump-type full --blame-hang-dump-type full --blame-hang-timeout 100minutes /p:SDKType=all /p:ServiceDirectory=keyvault /p:IncludeSrc=false /p:IncludeSamples=false /p:IncludePerf=false /p:IncludeStress=false /p:RunApiCompat=false /p:InheritDocEnabled=false /p:Configuration=Debug /p:CollectCoverage=false /p:EnableSourceLink=false /p:ProjectListOverrideFile= /p:UseProjectReferenceToAzureClients=false

Notice that is discovers, restores, and tries to build a bunch of packages. That should only be ~6-8 packages, and will otherwise build successfully if you:

  1. Change global.json to use "6.0.100" instead (or any 6.0.*).
  2. Change eng/Directory.Build.Common.props such that <RequiredTargetFrameworks>net6.0</RequiredTargetFrameworks>.

@jeffkl
Copy link
Contributor

jeffkl commented Dec 2, 2022

I am taking a look...

@heaths
Copy link
Member Author

heaths commented Dec 2, 2022

Oh, and for your other question offline, this does not repro for dotnet build:

dotnet build eng/service.proj --framework net6.0 -bl:"$PWD\msbuild.binlog" /p:SDKType=all /p:ServiceDirectory=keyvault /p:IncludeSrc=false /p:IncludeSamples=false /p:IncludePerf=false /p:IncludeStress=false /p:RunApiCompat=false /p:InheritDocEnabled=false /p:Configuration=Debug /p:CollectCoverage=false /p:EnableSourceLink=false /p:ProjectListOverrideFile= /p:UseProjectReferenceToAzureClients=false

@heaths
Copy link
Member Author

heaths commented Dec 2, 2022

Appears to be caused by microsoft/vstest#4014

@jeffkl jeffkl added the Duplicate This issue or pull request already exists label Dec 2, 2022
@jeffkl jeffkl moved this from To Do to Done in Traversal Dec 2, 2022
@heaths heaths closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate This issue or pull request already exists
Projects
Traversal
  
Done
Development

No branches or pull requests

2 participants