Skip to content

Commit ce33b64

Browse files
committed
more traces
1 parent cffdbf6 commit ce33b64

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

src/Cli/dotnet/CommandFactory/CommandResolution/ActivityContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static class ActivityContext
1717
return null;
1818
}
1919
var contextToInject = currentActivity.Context;
20-
if (contextToInject.TraceId == default || contextToInject.SpanId == default || contextToInject.TraceState is null)
20+
if (contextToInject.TraceId == default && contextToInject.SpanId == default && contextToInject.TraceState is null)
2121
{
2222
return null;
2323
}

src/Cli/dotnet/Commands/Tool/Execute/ToolExecuteCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ internal class ToolExecuteCommand(ParseResult result, ToolManifestFinder? toolMa
4141

4242
public override int Execute()
4343
{
44-
VersionRange versionRange = _parseResult.GetVersionRange();
44+
VersionRange? versionRange = _parseResult.GetVersionRange();
4545
PackageId packageId = new PackageId(_packageToolIdentityArgument.Id);
4646

4747
var toolLocationActivity = Activities.Source.StartActivity("find-tool");

src/Cli/dotnet/Commands/Tool/Install/ParseResultExtension.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
#nullable disable
5-
64
using System.CommandLine;
75
using Microsoft.DotNet.Cli.Utils;
86
using NuGet.Versioning;
@@ -11,7 +9,7 @@ namespace Microsoft.DotNet.Cli.Commands.Tool.Install;
119

1210
internal static class ParseResultExtension
1311
{
14-
public static VersionRange GetVersionRange(this ParseResult parseResult)
12+
public static VersionRange? GetVersionRange(this ParseResult parseResult)
1513
{
1614
var packageVersionFromIdentityArgument = parseResult.GetValue(ToolInstallCommandParser.PackageIdentityArgument).VersionRange?.OriginalString;
1715
var packageVersionFromVersionOption = parseResult.GetValue(ToolInstallCommandParser.VersionOption);
@@ -22,7 +20,7 @@ public static VersionRange GetVersionRange(this ParseResult parseResult)
2220
throw new GracefulException(CliStrings.PackageIdentityArgumentVersionOptionConflict);
2321
}
2422

25-
string packageVersion = packageVersionFromIdentityArgument ?? packageVersionFromVersionOption;
23+
string? packageVersion = packageVersionFromIdentityArgument ?? packageVersionFromVersionOption;
2624

2725
bool prerelease = parseResult.GetValue(ToolInstallCommandParser.PrereleaseOption);
2826

@@ -39,10 +37,10 @@ public static VersionRange GetVersionRange(this ParseResult parseResult)
3937
packageVersion = "*-*";
4038
}
4139

42-
VersionRange versionRange = null;
40+
VersionRange? versionRange = null;
4341

4442
// accept 'bare' versions and interpret 'bare' versions as NuGet exact versions
45-
if (!string.IsNullOrEmpty(packageVersion) && NuGetVersion.TryParse(packageVersion, out NuGetVersion version2))
43+
if (!string.IsNullOrEmpty(packageVersion) && NuGetVersion.TryParse(packageVersion, out NuGetVersion? version2))
4644
{
4745
return new VersionRange(minVersion: version2, includeMinVersion: true, maxVersion: version2, includeMaxVersion: true, originalString: "[" + packageVersion + "]");
4846
}

src/Cli/dotnet/Commands/Tool/Install/ToolInstallGlobalOrToolPathCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public ToolInstallGlobalOrToolPathCommand(
9292
NoCache: parseResult.GetValue(ToolCommandRestorePassThroughOptions.NoCacheOption) || parseResult.GetValue(ToolCommandRestorePassThroughOptions.NoHttpCacheOption),
9393
IgnoreFailedSources: parseResult.GetValue(ToolCommandRestorePassThroughOptions.IgnoreFailedSourcesOption),
9494
Interactive: parseResult.GetValue(ToolCommandRestorePassThroughOptions.InteractiveRestoreOption));
95-
nugetPackageDownloader ??= new NuGetPackageDownloader.NuGetPackageDownloader(tempDir, verboseLogger: new NullLogger(), restoreActionConfig: _restoreActionConfig, verbosityOptions: _verbosity, verifySignatures: verifySignatures ?? true);
95+
nugetPackageDownloader ??= new NuGetPackageDownloader.NuGetPackageDownloader(tempDir, verboseLogger: new NullLogger(), restoreActionConfig: _restoreActionConfig, verbosityOptions: _verbosity, verifySignatures: verifySignatures ?? true, shouldUsePackageSourceMapping: true);
9696
_shellShimTemplateFinder = new ShellShimTemplateFinder(nugetPackageDownloader, tempDir, packageSourceLocation);
9797
_store = store;
9898

@@ -155,7 +155,7 @@ private int ExecuteInstallCommand(PackageId packageId)
155155
toolPath = new DirectoryPath(_toolPath);
156156
}
157157

158-
VersionRange versionRange = _parseResult.GetVersionRange();
158+
VersionRange? versionRange = _parseResult.GetVersionRange();
159159

160160
(IToolPackageStore toolPackageStore,
161161
IToolPackageStoreQuery toolPackageStoreQuery,
@@ -241,7 +241,7 @@ private int ExecuteInstallCommand(PackageId packageId)
241241
return 0;
242242
}
243243

244-
private NuGetVersion GetBestMatchNugetVersion(PackageId packageId, VersionRange versionRange, IToolPackageDownloader toolPackageDownloader)
244+
private NuGetVersion GetBestMatchNugetVersion(PackageId packageId, VersionRange? versionRange, IToolPackageDownloader toolPackageDownloader)
245245
{
246246
return toolPackageDownloader.GetNuGetVersion(
247247
packageLocation: new PackageLocation(nugetConfig: GetConfigFile(), sourceFeedOverrides: _source, additionalFeeds: _addSource),

0 commit comments

Comments
 (0)