Skip to content

Commit

Permalink
Update to 5.2xx SDK (Azure#19216)
Browse files Browse the repository at this point in the history
  • Loading branch information
pakrym authored Mar 16, 2021
1 parent d7e8f6b commit 914ad9b
Show file tree
Hide file tree
Showing 21 changed files with 101 additions and 64 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- Install VS 2019 (Community or higher) and make sure you have the latest updates (https://www.visualstudio.com/).
- Need at least .NET Framework 4.6.1 and 4.7 development tools
- Install the **.NET Core cross-platform development** workloads in VisualStudio
- Install **.NET Core 5.0.100 SDK** for your specific platform. (or a higher version within the 5.0.*** band) (https://dotnet.microsoft.com/download/dotnet-core/5.0)
- Install **.NET Core 5.0.200 SDK** for your specific platform. (or a higher version within the 5.0.*** band) (https://dotnet.microsoft.com/download/dotnet-core/5.0)
- Install the latest version of git (https://git-scm.com/downloads)
- Install [PowerShell](https://docs.microsoft.com/powershell/scripting/install/installing-powershell), version 6 or higher, if you plan to make public API changes or are working with generated code snippets.
- Install [NodeJS](https://nodejs.org/) (14.x.x) if you plan to use [C# code generation](https://github.com/Azure/autorest.csharp).
Expand Down
2 changes: 1 addition & 1 deletion eng/Directory.Build.Data.props
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<GenerateAPIListing Condition="'$(IsShippingClientLibrary)' == 'true'">true</GenerateAPIListing>
<UpdateSourceOnBuild Condition="'$(UpdateSourceOnBuild)' == ''">$(AZURE_DEV_UPDATESOURCESONBUILD)</UpdateSourceOnBuild>
<PowerShellExe Condition="'$(PowerShellExe)' == ''">pwsh</PowerShellExe>
<InheritDocEnabled Condition="'$(InheritDocEnabled)'=='' and '$(DesignTimeBuild)'!='true' and '$(BuildingForLiveUnitTesting)'!='true'">true</InheritDocEnabled>
<InheritDocEnabled Condition="'$(InheritDocEnabled)'=='' and '$(DesignTimeBuild)'!='true' and '$(BuildingForLiveUnitTesting)'!='true' and '$(IsShippingClientLibrary)' == true">true</InheritDocEnabled>
<InheritDocTrimLevel>private</InheritDocTrimLevel>
</PropertyGroup>

Expand Down
26 changes: 13 additions & 13 deletions eng/pipelines/templates/steps/install-dotnet.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# All required SDKs/runtimes are available on DevOps agents
steps: []
#steps: []
# Installation steps need to be uncommented when switching to a newer SDK that's not available on DevOps agents
#steps:
# - task: UseDotNet@2
# displayName: 'Use .NET Core SDK'
# inputs:
# useGlobalJson: true
# performMultiLevelLookup: true
# - task: UseDotNet@2
# condition: ne(variables['Agent.OS'], 'Windows_NT') # Windows supports MultiLevelLookup and doesn't need explicit framework installation
# displayName: 'Use .NET Core 2.1 runtime'
# inputs:
# packageType: runtime
# version: "2.1.x"
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core SDK'
inputs:
useGlobalJson: true
performMultiLevelLookup: true
- task: UseDotNet@2
condition: ne(variables['Agent.OS'], 'Windows_NT') # Windows supports MultiLevelLookup and doesn't need explicit framework installation
displayName: 'Use .NET Core 2.1 runtime'
inputs:
packageType: runtime
version: "2.1.x"
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"Microsoft.Build.Traversal": "1.0.45"
},
"sdk": {
"version": "5.0.100",
"version": "5.0.200",
"rollForward": "feature"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,19 @@ public static string EncodePolygon(GeographyLineStringProxy line)

if (line.Points.Count < 4)
{
#pragma warning disable CA2208 // Instantiate argument exceptions correctly
throw new ArgumentException(
$"A GeographyLineString must have at least four Points to form a searchable polygon.",
$"{nameof(line)}.{nameof(line.Points)}");
#pragma warning restore CA2208 // Instantiate argument exceptions correctly
}
else if (line.Points[0] != line.Points[line.Points.Count - 1])
{
#pragma warning disable CA2208 // Instantiate argument exceptions correctly
throw new ArgumentException(
$"A GeographyLineString must have matching first and last Points to form a searchable polygon.",
$"{nameof(line)}.{nameof(line.Points)}");
#pragma warning restore CA2208 // Instantiate argument exceptions correctly
}

StringBuilder odata = new StringBuilder("geography'POLYGON((");
Expand Down Expand Up @@ -180,9 +184,11 @@ public static string EncodePolygon(GeographyPolygonProxy polygon)

if (polygon.Rings.Count != 1)
{
#pragma warning disable CA2208 // Instantiate argument exceptions correctly
throw new ArgumentException(
$"A GeographyPolygon must have exactly one Rings to form a searchable polygon.",
$"{nameof(polygon)}.{nameof(polygon.Rings)}");
#pragma warning restore CA2208 // Instantiate argument exceptions correctly
}

return EncodePolygon(polygon.Rings[0]);
Expand Down
2 changes: 2 additions & 0 deletions sdk/storage/Azure.Storage.Blobs.Batch/src/BatchConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ internal static class BatchConstants
public const string BatchSeparator = "--";
public const string HttpVersion = "HTTP/1.1";

#pragma warning disable CA1802 // Use literals where appropriate
public static readonly string DelayedResponsePropertyName = $"{nameof(BlobBatchClient)}.{nameof(BlobBatchClient.SubmitBatch)}:DelayedResponse";
#pragma warning restore CA1802 // Use literals where appropriate
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -173,22 +173,22 @@ private static void ValidateReadParameters(byte[] buffer, int offset, int count)

if (offset < 0)
{
throw new ArgumentOutOfRangeException($"{nameof(offset)} cannot be less than 0.");
throw new ArgumentOutOfRangeException(nameof(offset), $"{nameof(offset)} cannot be less than 0.");
}

if (offset > buffer.Length)
{
throw new ArgumentOutOfRangeException($"{nameof(offset)} cannot exceed {nameof(buffer)} length.");
throw new ArgumentOutOfRangeException(nameof(offset), $"{nameof(offset)} cannot exceed {nameof(buffer)} length.");
}

if (count < 0)
{
throw new ArgumentOutOfRangeException($"{nameof(count)} cannot be less than 0.");
throw new ArgumentOutOfRangeException(nameof(count), $"{nameof(count)} cannot be less than 0.");
}

if (offset + count > buffer.Length)
{
throw new ArgumentOutOfRangeException($"{nameof(offset)} + {nameof(count)} cannot exceed {nameof(buffer)} length.");
throw new ArgumentOutOfRangeException(nameof(count), $"{nameof(offset)} + {nameof(count)} cannot exceed {nameof(buffer)} length.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,23 @@ namespace Azure.Storage.Blobs.ChangeFeed
/// </summary>
public static BlobChangeFeedEventType BlobAsyncOperationInitiated { get; } = new BlobChangeFeedEventType("BlobAsyncOperationInitiated");

///<inheritdoc/>
/// <summary>
/// Compares equality of two <see cref="BlobChangeFeedEventType"/> instances.
/// </summary>
/// <param name="left">The <see cref="BlobChangeFeedEventType"/> to compare.</param>
/// <param name="right">The <see cref="BlobChangeFeedEventType"/> to compare to.</param>
/// <returns><c>true</c> if values of both BlobChangeFeedEventType are equal, otherwise <c>false</c>.</returns>
public static bool operator ==(BlobChangeFeedEventType left, BlobChangeFeedEventType right) => left.Equals(right);

///<inheritdoc/>
/// <summary>
/// Compares inequality of two <see cref="BlobChangeFeedEventType"/> instances.
/// </summary>
/// <param name="left">The <see cref="BlobChangeFeedEventType"/> to compare.</param>
/// <param name="right">The <see cref="BlobChangeFeedEventType"/> to compare to.</param>
/// <returns><c>true</c> if values of both BlobChangeFeedEventType are not equal, otherwise <c>false</c>.</returns>
public static bool operator !=(BlobChangeFeedEventType left, BlobChangeFeedEventType right) => !left.Equals(right);

///<inheritdoc/>
/// <summary> Converts a string to a <see cref="BlobChangeFeedEventType"/>. </summary>
public static implicit operator BlobChangeFeedEventType(string value) => new BlobChangeFeedEventType(value);

///<inheritdoc/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,23 @@ namespace Azure.Storage.Blobs.ChangeFeed
/// </summary>
public static BlobOperationName AbortCopyBlob { get; } = new BlobOperationName("AbortCopyBlob");

///<inheritdoc/>
/// <summary>
/// Compares equality of two <see cref="BlobOperationName"/> instances.
/// </summary>
/// <param name="left">The <see cref="BlobOperationName"/> to compare.</param>
/// <param name="right">The <see cref="BlobOperationName"/> to compare to.</param>
/// <returns><c>true</c> if values of both BlobOperationName are equal, otherwise <c>false</c>.</returns>
public static bool operator ==(BlobOperationName left, BlobOperationName right) => left.Equals(right);

///<inheritdoc/>
/// <summary>
/// Compares inequality of two <see cref="BlobOperationName"/> instances.
/// </summary>
/// <param name="left">The <see cref="BlobOperationName"/> to compare.</param>
/// <param name="right">The <see cref="BlobOperationName"/> to compare to.</param>
/// <returns><c>true</c> if values of both BlobOperationName are not equal, otherwise <c>false</c>.</returns>
public static bool operator !=(BlobOperationName left, BlobOperationName right) => !left.Equals(right);

///<inheritdoc/>
/// <summary> Converts a string to a <see cref="BlobOperationName"/>. </summary>
public static implicit operator BlobOperationName(string value) => new BlobOperationName(value);

///<inheritdoc/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,19 @@ await TestHelper.AssertExpectedExceptionAsync<ArgumentNullException>(

await TestHelper.AssertExpectedExceptionAsync<ArgumentOutOfRangeException>(
lazyStream.ReadAsync(buffer: new byte[10], offset: -1, count: 10),
new ArgumentOutOfRangeException("offset cannot be less than 0.", $"Specified argument was out of the range of valid values."));
new ArgumentOutOfRangeException("offset", "offset cannot be less than 0."));

await TestHelper.AssertExpectedExceptionAsync<ArgumentOutOfRangeException>(
lazyStream.ReadAsync(buffer: new byte[10], offset: 11, count: 10),
new ArgumentOutOfRangeException("offset cannot exceed buffer length.", $"Specified argument was out of the range of valid values."));
new ArgumentOutOfRangeException("offset", "offset cannot exceed buffer length."));

await TestHelper.AssertExpectedExceptionAsync<ArgumentOutOfRangeException>(
lazyStream.ReadAsync(buffer: new byte[10], offset: 1, count: -1),
new ArgumentOutOfRangeException("count cannot be less than 0.", $"Specified argument was out of the range of valid values."));
new ArgumentOutOfRangeException("count", "count cannot be less than 0."));

await TestHelper.AssertExpectedExceptionAsync<ArgumentOutOfRangeException>(
lazyStream.ReadAsync(buffer: new byte[10], offset: 5, count: 15),
new ArgumentOutOfRangeException("offset + count cannot exceed buffer length.", $"Specified argument was out of the range of valid values."));
new ArgumentOutOfRangeException("count", "offset + count cannot exceed buffer length."));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public BlobQuickQueryStream(
public override int Read(byte[] buffer, int offset, int count)
=> ReadInternal(async: false, buffer, offset, count).EnsureCompleted();

/// <inheritdoc/>
/// <inheritdoc cref="Stream.ReadAsync(byte[],int,int)"/>
public new async Task<int> ReadAsync(byte[] buffer, int offset, int count)
=> await ReadInternal(async: true, buffer, offset, count).ConfigureAwait(false);

Expand Down
4 changes: 3 additions & 1 deletion sdk/storage/Azure.Storage.Blobs/src/Models/ContentRange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ public RangeUnit(string value)
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object obj) => obj is RangeUnit other && Equals(other);

/// <inheritdoc/>
/// <summary>
/// Indicates whether this instance and a specified <see cref="RangeUnit"/> are equal
/// </summary>
public bool Equals(RangeUnit other) => string.Equals(_value, other._value, StringComparison.Ordinal);

/// <inheritdoc/>
Expand Down
10 changes: 5 additions & 5 deletions sdk/storage/Azure.Storage.Blobs/tests/BlobBaseClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1977,15 +1977,15 @@ await TestHelper.AssertExpectedExceptionAsync<ArgumentNullException>(

await TestHelper.AssertExpectedExceptionAsync<ArgumentOutOfRangeException>(
stream.ReadAsync(buffer: new byte[10], offset: -1, count: 10),
new ArgumentOutOfRangeException("offset cannot be less than 0.", "Specified argument was out of the range of valid values."));
new ArgumentOutOfRangeException("offset", "offset cannot be less than 0."));

await TestHelper.AssertExpectedExceptionAsync<ArgumentOutOfRangeException>(
stream.ReadAsync(buffer: new byte[10], offset: 11, count: 10),
new ArgumentOutOfRangeException("offset cannot exceed buffer length.", "Specified argument was out of the range of valid values."));
new ArgumentOutOfRangeException("offset", "offset cannot exceed buffer length."));

await TestHelper.AssertExpectedExceptionAsync<ArgumentOutOfRangeException>(
stream.ReadAsync(buffer: new byte[10], offset: 1, count: -1),
new ArgumentOutOfRangeException("count cannot be less than 0.", "Specified argument was out of the range of valid values."));
new ArgumentOutOfRangeException("count", "count cannot be less than 0."));
}

[Test]
Expand Down Expand Up @@ -2030,7 +2030,7 @@ public async Task OpenReadAsync_Seek_NegativeNewPosition()
Stream outputStream = await blob.OpenReadAsync().ConfigureAwait(false);
TestHelper.AssertExpectedException<ArgumentException>(
() => outputStream.Seek(-10, SeekOrigin.Begin),
new ArgumentException("New offset cannot be less than 0. Value was -10"));
new ArgumentException("New offset cannot be less than 0. Value was -10", "offset"));
}

[Test]
Expand All @@ -2053,7 +2053,7 @@ public async Task OpenReadAsync_Seek_NewPositionGreaterThanBlobLength(bool allow
Stream outputStream = await blob.OpenReadAsync(options).ConfigureAwait(false);
TestHelper.AssertExpectedException<ArgumentException>(
() => outputStream.Seek(1025, SeekOrigin.Begin),
new ArgumentException("You cannot seek past the last known length of the underlying blob or file."));
new ArgumentException("You cannot seek past the last known length of the underlying blob or file.", "offset"));

Assert.AreEqual(size, outputStream.Length);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ public ClientSideEncryptionAlgorithm(string value)
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object obj) => obj is ClientSideEncryptionAlgorithm other && Equals(other);

/// <inheritdoc/>
/// <summary>
/// Indicates whether this instance and a specified <see cref="ClientSideEncryptionAlgorithm"/> are equal
/// </summary>
public bool Equals(ClientSideEncryptionAlgorithm other) => string.Equals(_value, other._value, StringComparison.Ordinal);

/// <inheritdoc/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,17 +233,17 @@ private static void ValidateReadParameters(byte[] buffer, int offset, int count)

if (offset < 0)
{
throw new ArgumentOutOfRangeException($"{nameof(offset)} cannot be less than 0.");
throw new ArgumentOutOfRangeException(nameof(offset), $"{nameof(offset)} cannot be less than 0.");
}

if (offset > buffer.Length)
{
throw new ArgumentOutOfRangeException($"{nameof(offset)} cannot exceed {nameof(buffer)} length.");
throw new ArgumentOutOfRangeException(nameof(offset), $"{nameof(offset)} cannot exceed {nameof(buffer)} length.");
}

if (count < 0)
{
throw new ArgumentOutOfRangeException($"{nameof(count)} cannot be less than 0.");
throw new ArgumentOutOfRangeException(nameof(count), $"{nameof(count)} cannot be less than 0.");
}
}

Expand All @@ -268,7 +268,7 @@ private async Task<long> GetBlobLengthInternal(bool async, CancellationToken can

if (lengthString == null)
{
throw new ArgumentException($"{HttpHeader.Names.ContentLength} header is mssing on get properties response.");
throw new ArgumentException($"{HttpHeader.Names.ContentLength} header is missing on get properties response.");
}

return Convert.ToInt64(lengthString, CultureInfo.InvariantCulture);
Expand All @@ -280,7 +280,7 @@ private static long GetBlobLengthFromResponse(Response response)

if (lengthString == null)
{
throw new ArgumentException("Content-Range header is mssing on download response.");
throw new ArgumentException("Content-Range header is missing on download response.");
}

string[] split = lengthString.Split('/');
Expand Down Expand Up @@ -332,14 +332,13 @@ public override long Seek(long offset, SeekOrigin origin)
// newPosition < 0
if (newPosition < 0)
{
throw new ArgumentException($"New {nameof(offset)} cannot be less than 0. Value was {newPosition}");
throw new ArgumentException($"New {nameof(offset)} cannot be less than 0. Value was {newPosition}", nameof(offset));
}

// newPosition > _length
if (newPosition > _length)
{
throw new ArgumentException(
"You cannot seek past the last known length of the underlying blob or file.");
throw new ArgumentException("You cannot seek past the last known length of the underlying blob or file.", nameof(offset));
}

// newPosition is less than _position, but within _buffer.
Expand Down Expand Up @@ -377,14 +376,14 @@ internal long CalculateNewPosition(long offset, SeekOrigin origin)
case SeekOrigin.End:
if (_allowBlobModifications)
{
throw new ArgumentException($"Cannot {nameof(Seek)} with {nameof(SeekOrigin)}.{nameof(SeekOrigin.End)} on a growing blob or file. Call Stream.Seek(Stream.Length, SeekOrigin.Begin) to get to the end of known data.");
throw new ArgumentException($"Cannot {nameof(Seek)} with {nameof(SeekOrigin)}.{nameof(SeekOrigin.End)} on a growing blob or file. Call Stream.Seek(Stream.Length, SeekOrigin.Begin) to get to the end of known data.", nameof(origin));
}
else
{
return _length + offset;
}
default:
throw new ArgumentException($"Unknown ${nameof(SeekOrigin)} value");
throw new ArgumentException($"Unknown ${nameof(SeekOrigin)} value", nameof(origin));
}
}

Expand Down
Loading

0 comments on commit 914ad9b

Please sign in to comment.