Skip to content

workload repair can recover from corrupt workload sets (#52434)#52700

Closed
nagilson wants to merge 5 commits intodotnet:release/10.0.2xxfrom
nagilson:nagilson-workload-corruption-10200-backport
Closed

workload repair can recover from corrupt workload sets (#52434)#52700
nagilson wants to merge 5 commits intodotnet:release/10.0.2xxfrom
nagilson:nagilson-workload-corruption-10200-backport

Conversation

@nagilson
Copy link
Member

A backport of #52434
resolve #52483

Co-authored-by: Marc Paine <marcpop@microsoft.com>
Copilot AI review requested due to automatic review settings January 28, 2026 00:41
@nagilson nagilson requested a review from a team January 28, 2026 00:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR is a backport of #52434 that fixes issue #52483, enabling workload repair to recover from corrupt workload sets. The issue occurs when package managers delete workload manifests from older SDK versions during updates, breaking the SDK's workload functionality.

Changes:

  • Introduces a corruption detection and repair mechanism that checks for missing manifests before workload operations
  • Adds a new IWorkloadManifestCorruptionRepairer interface and implementation that reinstalls missing manifests
  • Updates SdkDirectoryWorkloadManifestProvider to check manifest health and throw helpful error messages
  • Ensures history recording ignores corruption to avoid failures when logging state

Reviewed changes

Copilot reviewed 42 out of 43 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
IWorkloadManifestCorruptionRepairer.cs New interface for manifest corruption repair hook
WorkloadManifestCorruptionRepairer.cs Implementation that detects and repairs missing manifests by reinstalling them
SdkDirectoryWorkloadManifestProvider.cs Adds corruption detection, failure modes, and calls to repairer
IWorkloadManifestProvider.cs New enum defining how to handle manifest corruption (Repair/Throw/Ignore)
WorkloadInstallerFactory.cs Attaches corruption repairer when installer is created
WorkloadHistoryRecorder.cs Sets failure mode to Ignore when recording history
MockWorkloadResolver.cs Adds manifestProvider parameter support for tests
MockPackWorkloadInstaller.cs Implements RepairWorkloads and writes manifest files to disk
CorruptWorkloadSetTestHelper.cs New test helper that sets up corrupt workload scenarios
GivenDotnetWorkloadRepair.cs New test validating repair of corrupt manifests
GivenDotnetWorkloadUpdate.cs Updated tests with manifestProvider and new corruption repair test
SdkDirectoryWorkloadManifestProviderTests.cs Updated exception types from FileNotFoundException to InvalidOperationException
Strings.resx and xlf files New localized error message for missing manifests

nagilson and others added 2 commits January 28, 2026 14:20
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Member

@MiYanni MiYanni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but this file doesn't exist in main. How do these changes flow forward?

}

if (!provider?.HasMissingManifests(workloadSet) ?? true)
if (provider == null || !provider.HasMissingManifests(workloadSet))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this actually changing functionality? Is it because the actual predicate should be: if (!(provider?.HasMissingManifests(workloadSet) ?? true))

Copy link
Member Author

@nagilson nagilson Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question, No, it's just making it more clear. The code from 10.0.1xx flowed into 10.0.2xx before this got merged, so this was supposed to have the whole change, this is just copilot's suggestion to make it more clear

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll just push this in main so we don't have to service a copilot edit

@nagilson nagilson changed the base branch from release/10.0.2xx to main January 30, 2026 22:35
@nagilson nagilson requested review from a team and tmat as code owners January 30, 2026 22:35
@nagilson nagilson changed the base branch from main to release/10.0.2xx January 30, 2026 22:35
@nagilson nagilson removed request for a team and tmat January 30, 2026 22:36
@nagilson
Copy link
Member Author

nagilson commented Jan 30, 2026

this isn't needed as it flowed, ill have copilot port this

@nagilson nagilson closed this Jan 30, 2026
Copilot AI added a commit that referenced this pull request Jan 30, 2026
This ports the fixes from PR #52700 (backport of #52434) to main branch, including:
- Workload repair can now recover from corrupt workload sets
- Added WorkloadManifestCorruptionRepairer to detect and repair missing manifests
- Updated WorkloadInstallerFactory to use the repairer
- Added proper error messages for corrupt workload sets
- Copilot improvements: clarified nullability check, removed extra blank lines, removed unused import

Resolves workload corruption issue where manifests are removed by package managers.

Co-authored-by: nagilson <23152278+nagilson@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants