Skip to content
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

Update NuGet.Configuration, NuGet.Credentials and NuGet.Protocol #7041

Merged
merged 5 commits into from
Sep 25, 2023
Merged
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
6 changes: 3 additions & 3 deletions eng/dependabot/Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
<PackageReference Update="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Update="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
<PackageReference Update="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
<PackageReference Update="NuGet.Configuration" Version="6.6.1" />
<PackageReference Update="NuGet.Credentials" Version="6.6.1" />
<PackageReference Update="NuGet.Protocol" Version="6.6.1" />
<PackageReference Update="NuGet.Configuration" Version="6.7.0" />
<PackageReference Update="NuGet.Credentials" Version="6.7.0" />
<PackageReference Update="NuGet.Protocol" Version="6.7.0" />

<!--Analyzers-->
<PackageReference Update="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.4" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal NuGetFloatRangeSpecification(FloatRange version)

public bool CheckIfVersionIsValid(string versionToCheck)
{
if (NuGetVersion.TryParse(versionToCheck, out NuGetVersion nuGetVersion2))
if (NuGetVersion.TryParse(versionToCheck, out NuGetVersion? nuGetVersion2))
{
return _version.Satisfies(nuGetVersion2);
}
Expand All @@ -28,9 +28,9 @@ public bool CheckIfVersionIsValid(string versionToCheck)

internal static bool TryParse(string value, out NuGetFloatRangeSpecification? version)
{
if (FloatRange.TryParse(value, out FloatRange versionRange))
if (FloatRange.TryParse(value, out FloatRange? versionRange))
{
version = new NuGetFloatRangeSpecification(versionRange);
version = new NuGetFloatRangeSpecification(versionRange!);
return true;
}
version = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal NuGetVersionRangeSpecification(VersionRange versionRange)

public bool CheckIfVersionIsValid(string versionToCheck)
{
if (NuGetVersion.TryParse(versionToCheck, out NuGetVersion nuGetVersion2))
if (NuGetVersion.TryParse(versionToCheck, out NuGetVersion? nuGetVersion2))
{
return _versionRange.Satisfies(nuGetVersion2);
}
Expand All @@ -28,9 +28,9 @@ public bool CheckIfVersionIsValid(string versionToCheck)

internal static bool TryParse(string value, out NuGetVersionRangeSpecification? version)
{
if (VersionRange.TryParse(value, out VersionRange versionRange))
if (VersionRange.TryParse(value, out VersionRange? versionRange))
{
version = new NuGetVersionRangeSpecification(versionRange);
version = new NuGetVersionRangeSpecification(versionRange!);
return true;
}
version = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal NuGetVersionSpecification(NuGetVersion version)

public bool CheckIfVersionIsValid(string versionToCheck)
{
if (NuGetVersion.TryParse(versionToCheck, out NuGetVersion nuGetVersion2))
if (NuGetVersion.TryParse(versionToCheck, out NuGetVersion? nuGetVersion2))
{
return _version == nuGetVersion2;
}
Expand All @@ -28,9 +28,9 @@ public bool CheckIfVersionIsValid(string versionToCheck)

internal static bool TryParse(string value, out NuGetVersionSpecification? version)
{
if (NuGetVersion.TryParse(value, out NuGetVersion nuGetVersion))
if (NuGetVersion.TryParse(value, out NuGetVersion? nuGetVersion))
{
version = new NuGetVersionSpecification(nuGetVersion);
version = new NuGetVersionSpecification(nuGetVersion!);
return true;
}
version = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static bool IsSupportedVersionString(string? versionString)
||
NuGetVersion.TryParse(versionString, out _)
||
FloatRange.TryParse(versionString, out _);
FloatRange.TryParse(versionString!, out _);
}

public static bool IsUnrestricted(this FloatRange floatRange)
Expand All @@ -37,7 +37,7 @@ public static bool TryParseFloatRangeEx(string? versionString, out FloatRange fl
{
floatRange =
string.IsNullOrEmpty(versionString) ?
UnspecifiedVersion : FloatRange.Parse(versionString);
UnspecifiedVersion : FloatRange.Parse(versionString!);

return floatRange.FloatBehavior != NuGetVersionFloatBehavior.None;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ await GetLatestVersionInternalAsync(
}
else
{
NuGetVersion packageVersion = new NuGetVersion(version);
NuGetVersion packageVersion = new NuGetVersion(version!);
(source, packageMetadata) = await GetPackageMetadataAsync(identifier, packageVersion, packagesSources, cancellationToken).ConfigureAwait(false);
}

Expand All @@ -94,7 +94,7 @@ await GetLatestVersionInternalAsync(
throw new VulnerablePackageException(
string.Format(LocalizableStrings.NuGetApiPackageManager_DownloadError_VulnerablePackage, source),
packageMetadata.Identity.Id,
foundPackageVersion,
foundPackageVersion!,
packageMetadata.Vulnerabilities);
}

Expand Down Expand Up @@ -204,9 +204,9 @@ await GetLatestVersionInternalAsync(

//if preview version is installed, check for the latest preview version, otherwise for latest stable
bool previewVersionInstalled = false;
if (NuGetVersion.TryParse(version, out NuGetVersion currentVersion))
if (NuGetVersion.TryParse(version, out NuGetVersion? currentVersion))
{
previewVersionInstalled = currentVersion.IsPrerelease;
previewVersionInstalled = currentVersion!.IsPrerelease;
}

FloatRange floatRange = new FloatRange(previewVersionInstalled ? NuGetVersionFloatBehavior.AbsoluteLatest : NuGetVersionFloatBehavior.Major);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ internal async Task<string> DownloadPackageAsync(
else
{
_nugetLogger.LogDebug($"[NuGet Package Manager] Getting package metadata {identifier}::{version}.");
packageVersion = new NuGetVersion(version);
packageVersion = new NuGetVersion(version!);
(source, packageMetadata) = await GetPackageMetadataAsync(identifier, packageVersion, packagesSources, cancellationToken).ConfigureAwait(false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public async Task<IDownloadedPackInfo> DownloadPackageAsync(ITemplatePackageInfo
using Stream packageStream = File.Create(outputPackageFileNameFullPath);
if (await _downloadResource.CopyNupkgToStreamAsync(
packinfo.Name,
new NuGetVersion(packinfo.Version),
new NuGetVersion(packinfo.Version!),
packageStream,
_cacheContext,
NullLogger.Instance,
Expand Down
Loading