Skip to content

Commit

Permalink
Fix compile error when Azure SDK is targeting .NET 6.
Browse files Browse the repository at this point in the history
Will fix compile error in Azure/azure-sdk-for-net#28911.
  • Loading branch information
AraHaan authored May 22, 2022
1 parent b20e5ee commit b3e6e0c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/assets/Generator.Shared/FormUrlEncodedContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ private void BuildIfNeeded ()
public override async Task WriteToAsync(Stream stream, CancellationToken cancellation)
{
BuildIfNeeded ();
#if NET6_0_OR_NEWER
await stream.WriteAsync(_bytes.AsSpan(0, _bytes.Length), cancellation).ConfigureAwait(false);
#else
await stream.WriteAsync(_bytes, 0, _bytes.Length, cancellation).ConfigureAwait(false);
#endif
}

public override void WriteTo(Stream stream, CancellationToken cancellation)
Expand Down

0 comments on commit b3e6e0c

Please sign in to comment.