-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Port workload corruption repair to main from release/10.0.2xx #52758
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
base: main
Are you sure you want to change the base?
Changes from all commits
6b92bf7
d99967c
29f9493
3da02c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,118 @@ | ||||||||||||||||||||||||||
| // Licensed to the .NET Foundation under one or more agreements. | ||||||||||||||||||||||||||
| // The .NET Foundation licenses this file to you under the MIT license. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| using System.Diagnostics.CodeAnalysis; | ||||||||||||||||||||||||||
| using Microsoft.DotNet.Cli; | ||||||||||||||||||||||||||
| using Microsoft.DotNet.Cli.Commands.Workload.Install; | ||||||||||||||||||||||||||
| using Microsoft.DotNet.Cli.NuGetPackageDownloader; | ||||||||||||||||||||||||||
| using Microsoft.DotNet.Cli.Utils; | ||||||||||||||||||||||||||
| using Microsoft.NET.Sdk.WorkloadManifestReader; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| namespace Microsoft.DotNet.Cli.Commands.Workload; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| internal sealed class WorkloadManifestCorruptionRepairer : IWorkloadManifestCorruptionRepairer | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| private readonly IReporter _reporter; | ||||||||||||||||||||||||||
| private readonly IInstaller _workloadInstaller; | ||||||||||||||||||||||||||
| private readonly IWorkloadResolver _workloadResolver; | ||||||||||||||||||||||||||
| private readonly SdkFeatureBand _sdkFeatureBand; | ||||||||||||||||||||||||||
| private readonly string _dotnetPath; | ||||||||||||||||||||||||||
| private readonly string _userProfileDir; | ||||||||||||||||||||||||||
| private readonly INuGetPackageDownloader? _packageDownloader; | ||||||||||||||||||||||||||
| private readonly PackageSourceLocation? _packageSourceLocation; | ||||||||||||||||||||||||||
| private readonly VerbosityOptions _verbosity; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
Comment on lines
+16
to
+24
|
||||||||||||||||||||||||||
| private bool _checked; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| public WorkloadManifestCorruptionRepairer( | ||||||||||||||||||||||||||
| IReporter reporter, | ||||||||||||||||||||||||||
| IInstaller workloadInstaller, | ||||||||||||||||||||||||||
| IWorkloadResolver workloadResolver, | ||||||||||||||||||||||||||
| SdkFeatureBand sdkFeatureBand, | ||||||||||||||||||||||||||
| string dotnetPath, | ||||||||||||||||||||||||||
| string userProfileDir, | ||||||||||||||||||||||||||
| INuGetPackageDownloader? packageDownloader, | ||||||||||||||||||||||||||
| PackageSourceLocation? packageSourceLocation, | ||||||||||||||||||||||||||
| VerbosityOptions verbosity) | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| _reporter = reporter ?? NullReporter.Instance; | ||||||||||||||||||||||||||
| _workloadInstaller = workloadInstaller; | ||||||||||||||||||||||||||
| _workloadResolver = workloadResolver; | ||||||||||||||||||||||||||
| _sdkFeatureBand = sdkFeatureBand; | ||||||||||||||||||||||||||
| _dotnetPath = dotnetPath; | ||||||||||||||||||||||||||
| _userProfileDir = userProfileDir; | ||||||||||||||||||||||||||
| _packageDownloader = packageDownloader; | ||||||||||||||||||||||||||
| _packageSourceLocation = packageSourceLocation; | ||||||||||||||||||||||||||
| _verbosity = verbosity; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| public void EnsureManifestsHealthy(ManifestCorruptionFailureMode failureMode) | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| if (_checked) | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| _checked = true; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if (failureMode == ManifestCorruptionFailureMode.Ignore) | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
Comment on lines
+56
to
+62
|
||||||||||||||||||||||||||
| _checked = true; | |
| if (failureMode == ManifestCorruptionFailureMode.Ignore) | |
| { | |
| return; | |
| } | |
| if (failureMode == ManifestCorruptionFailureMode.Ignore) | |
| { | |
| return; | |
| } | |
| _checked = true; |
Copilot
AI
Feb 10, 2026
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.
The message "Repairing workload set {version}..." is user-facing and currently hardcoded. Consider moving it to CliCommandStrings (and XLF) for localization consistency with the rest of the workload command output.
| _reporter.WriteLine($"Repairing workload set {workloadSet.Version}..."); | |
| _reporter.WriteLine(string.Format(CliCommandStrings.RepairingWorkloadSet, workloadSet.Version)); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
using Microsoft.DotNet.Cli.Commands.Workload;looks unused in this file (types are either in the current namespace subtree or referenced via other usings). With warnings-as-errors enabled, this may fail the build; please remove the unnecessary using.