-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix baseline manifest version for RTM branding #43737
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
Fix baseline manifest version for RTM branding #43737
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit confusing with nullable annotations being added and moving the workload set version <--> workload set package version logic to a new class on top of the real change (a little error catching code in SdkDirectoryWorkloadManifestProvider and making a new task to return the workload set feature band).
I'm a little unclear as to whether this is the right direction. My impression was that a preview SDK should use a preview feature band for its baseline manifest. It should find its preview baseline set (along with closely related preview baseline sets). A release 9.0.100 SDK shouldn't find the preview baseline set, as it should find its own.
In that case, the only real bug here is that GC is doing the feature band calculation wrong, which should be a smaller/easier fix anyway.
As an aside, that regex was pulled from how we calculate feature bands for some individual workloads. (Example) If you think we should be using a different feature band for the folder we put workload sets into, do we also need to update those?
Preview SDKs do use preview feature bands. If you have SDK version
Yes, we should be consistent in how we calculate feature bands, so if we can switch from MSBuild regexes to a task which calls the same code the product uses, that would be good. |
a0cdfec
to
c2d4357
Compare
|
||
public override bool Execute() | ||
{ | ||
WorkloadSetFeatureBand = Microsoft.DotNet.Workloads.Workload.WorkloadSetVersion.GetFeatureBand(WorkloadSetVersion).ToString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Can we capture some of this in a using
statement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
<ItemGroup> | ||
<PackageReference Include="Microsoft.Build.Tasks.Core" /> | ||
<PackageReference Include="Microsoft.Build.Utilities.Core" /> | ||
<PackageReference Include="Newtonsoft.Json" /> | ||
<PackageReference Include="NuGet.Versioning" /> | ||
<PackageReference Include="NuGet.Packaging" /> | ||
<PackageReference Include="System.Reflection.Metadata" VersionOverride="$(SystemReflectionMetadataLoadContextVersion)" /> | ||
<PackageReference Include="Microsoft.Deployment.DotNet.Releases" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this trigger an additional module load for VS perf tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is in the core-sdk-tasks
project, which is the tasks used by the .NET SDK build itself. So it won't affect the tasks that are part of the .NET SDK and get used by most developers when building projects with the .NET SDK. Those tasks (and the resolvers) which are loaded into VS already reference this package.
@@ -48,7 +49,7 @@ public static IEnumerable<object[]> WorkloadVersionsData | |||
[MemberData(nameof(WorkloadVersionsData))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we include an item in the member data for version that contain rtm
since that's one of the special cases handled by SdkFeatureBand
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -11,6 +11,7 @@ | |||
using System.Text.Json.Serialization; | |||
using System.Threading.Tasks; | |||
using Microsoft.DotNet.MsiInstallerTests.Framework; | |||
using Microsoft.DotNet.Workloads.Workload; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably sort these usings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed the unused usings. I think the System namespace should generally be sorted before other namespaces in the usings, so I think other than that they are sorted.
In #43483, we hit a test failure where a workload uninstall command was failing. On investigation, this was because during the SDK build when the baseline workload set was being created, its feature band was being calculated incorrectly. This led to the workload set being included in a folder such as
sdk-manifests\9.0.100-rtm.24476\workloadsets\9.0.100-rtm.24476.1
, using9.0.100-rtm.24476
for the feature band instead of9.0.100
which would have been correct.When the SDK scanned for workload sets it would find this as workload set
9.0.100-rtm.24476.1
, but when during garbage collection it tried to load the workload set, it would calculate its feature band as9.0.100
and look for the workload set under thesdk-manifests\9.0.100
folder, and fail when it couldn't be found. This meant garbage collection would always fail. For most workload commands this would be reported as a warning, but for the uninstall command it would cause the whole command to fail.This PR fixes the issue in two ways:
Correctly calculate baseline workload set feature band
The
LayoutManifests
target of the build was using a regex to calculate the feature band based on the workload set version. This PR changes that to use a build task that calls the same code that the product does to do the workload set version mapping. This involves:WorkloadSetVersion
classdotnet
project, so that theWorkloadSetVersion
class could use nullability annotations (since it also is consumed by projects that have nullability enabled)NuGetVersion
toReleaseVersion
in theWorkloadSetVersion.FromWorkloadSetPackageVersion
logic. Previously, the methods to convert in different directions where in different locations, to avoid adding a dependency on the NuGet APIs where it wasn't necessary.ReleaseVersion
appears to be available in all the locations that these methods are used, so it is a better choice. However, making this change introduces risk that a difference in behavior betweenNuGetVersion
andReleaseVersion
could cause this to be a change in the SDK behavior.GetWorkloadSetFeatureBand
task in core-sdk-tasks and using it in theLayoutManifests
target to calculate the feature band for the baseline workload setIgnore workload sets with invalid or mismatched feature bands when scanning for available workload sets
This is a change to
SdkDirectoryWorkloadManifestProvider
. When scanning for workload sets, it ignores any that it would not be able to find later based on the workload set version due to a mismatched feature band folder. This will avoid errors if the SDK later tries to load that workload set and can't find it.However, this does somewhat reduce the diagnosibility of issues, as it will silently ignore any workload sets that are in the wrong feature band folder. The
SdkDirectoryWorkloadManifestProvider
doesn't currently have any way to write warnings or similar messages to a log.