Skip to content

Error condition fix Fixes #40297 #41741

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Cli/dotnet/commands/InstallingWorkloadCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ protected bool TryHandleWorkloadUpdateFromVersion(ITransactionContext context, D
_workloadInstaller.UpdateInstallMode(_sdkFeatureBand, true);
}

// Delete the current advertising manifest because if we fail to find the right workload version, we want to fail.
var advertisingPackagePath = Path.Combine(_userProfileDir, "sdk-advertising", _sdkFeatureBand.ToString(), "microsoft.net.workloads");
Copy link
Member

Choose a reason for hiding this comment

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

nit: Can you pull microsoft.net.workloads out into a variable with a clear name so we can tell this is the workload set folder?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

dsplaisted creates that as a constant in #39991, so I'd rather wait for that to come in then move it somewhere more central and use it.

if (Directory.Exists(advertisingPackagePath))
{
Directory.Delete(advertisingPackagePath, recursive: true);
}
Comment on lines +126 to +131
Copy link
Member

Choose a reason for hiding this comment

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

I think after my refactoring, this is probably not necessary anymore. Can you verify or explain what the scenario was where this was broken?


_workloadManifestUpdater.DownloadWorkloadSet(_workloadSetVersionFromGlobalJson ?? _workloadSetVersion, offlineCache);
return TryInstallWorkloadSet(context, out updates, throwOnFailure: true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,6 @@
<value>No workload update found.</value>
</data>
<data name="WorkloadVersionRequestedNotFound" xml:space="preserve">
<value>Workload version {0} not found.</value>
<value>Workload version {0} not found. Adding a feed that contains it to your NuGet.config may help.</value>
Copy link
Member

Choose a reason for hiding this comment

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

The message now uses WorkloadVersionFromGlobalJsonNotFound, and the text is:

Workload update failed: Workload version 8.0.300-preview.0.24217.2, which was specified in C:\SdkTesting\global.json, was not found. Run "dotnet workload restore" to install this workload version.

I don't think we need a message here about adding a feed, as in most cases the workload should be available on NuGet.org and they shouldn't need to mess with their feeds. If the dotnet workload restore command fails, that's when we could mention the feeds. It looks like that message could stand to be cleaned up, currently it looks something like this:

Unhandled exception: System.IO.FileNotFoundException: Workload version 8.0.300-preview.0.24217.2, which was specified in C:\SdkTesting\global.json, was not found. Run "dotnet workload restore" to install this workload version.
at Microsoft.NET.Sdk.WorkloadManifestReader.SdkDirectoryWorkloadManifestProvider.ThrowExceptionIfManifestsNotAvailable() in C:\git\dotnet-sdk\src\Resolvers\Microsoft.NET.Sdk.WorkloadManifestReader\SdkDirectoryWorkloadManifestProvider.cs:line 231
at Microsoft.NET.Sdk.WorkloadManifestReader.SdkDirectoryWorkloadManifestProvider.GetManifests() in C:\git\dotnet-sdk\src\Resolvers\Microsoft.NET.Sdk.WorkloadManifestReader\SdkDirectoryWorkloadManifestProvider.cs:line 269
at Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadResolver.LoadManifestsFromProvider(IWorkloadManifestProvider manifestProvider) in C:\git\dotnet-sdk\src\Resolvers\Microsoft.NET.Sdk.WorkloadManifestReader\WorkloadResolver.cs:line 124
at Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadResolver.InitializeManifests() in C:\git\dotnet-sdk\src\Resolvers\Microsoft.NET.Sdk.WorkloadManifestReader\WorkloadResolver.cs:line 91
at Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadResolver.GetInstalledManifests() in C:\git\dotnet-sdk\src\Resolvers\Microsoft.NET.Sdk.WorkloadManifestReader\WorkloadResolver.cs:line 771
at Microsoft.DotNet.Workloads.Workload.Update.WorkloadUpdateCommand.Execute() in C:\git\dotnet-sdk\src\Cli\dotnet\commands\dotnet-workload\update\WorkloadUpdateCommand.cs:line 86
at Microsoft.DotNet.Cli.WorkloadUpdateCommandParser.<>c.b__6_0(ParseResult parseResult) in C:\git\dotnet-sdk\src\Cli\dotnet\commands\dotnet-workload\update\WorkloadUpdateCommandParser.cs:line 52
at System.CommandLine.Invocation.AnonymousCliAction.Invoke(ParseResult parseResult)
at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult parseResult)
at System.CommandLine.ParseResult.Invoke()
at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient) in C:\git\dotnet-sdk\src\Cli\dotnet\Program.cs:line 232

</data>
</root>

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.

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.