@@ -12,7 +12,9 @@ namespace Manandre.IO
1212 using System . Threading ;
1313 using System . Threading . Tasks ;
1414 using Nito . AsyncEx ;
15+ #if ! NETSTANDARD1_3
1516 using Nito . AsyncEx . Interop ;
17+ #endif
1618 using Nito . AsyncEx . Synchronous ;
1719
1820 /// <summary>
@@ -327,7 +329,11 @@ public sealed override void Write(byte[] buffer, int offset, int count)
327329 /// Asynchronously releases all resources used by the AsyncStream.
328330 /// </summary>
329331 /// <returns>A ValueTask representing the dispose operation.</returns>
330- public sealed override ValueTask DisposeAsync ( ) => this . DisposeAsync ( true ) ;
332+ public sealed override async ValueTask DisposeAsync ( )
333+ {
334+ await this . DisposeAsync ( true ) . ConfigureAwait ( false ) ;
335+ await base . DisposeAsync ( ) . ConfigureAwait ( false ) ;
336+ }
331337
332338 /// <summary>
333339 /// Asynchronously releases the unmanaged resources used by the FollowingFileStream and optionally
@@ -342,7 +348,11 @@ public sealed override void Write(byte[] buffer, int offset, int count)
342348 /// releases the managed resources.
343349 /// </summary>
344350 /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
345- protected sealed override void Dispose ( bool disposing ) => this . DisposeAsync ( disposing ) . GetAwaiter ( ) . GetResult ( ) ;
351+ protected sealed override void Dispose ( bool disposing )
352+ {
353+ this . DisposeAsync ( disposing ) . AsTask ( ) . GetAwaiter ( ) . GetResult ( ) ;
354+ base . Dispose ( disposing ) ;
355+ }
346356#else
347357 /// <summary>
348358 /// Releases the unmanaged resources used by the FollowingFileStream and optionally
@@ -517,7 +527,7 @@ protected override async ValueTask DisposeAsync(bool disposing)
517527 this . cts . Cancel ( ) ;
518528 using ( await this . locker . LockAsync ( ) )
519529 {
520- await ( ( IAsyncDisposable ) this . asyncStream ) . DisposeAsync ( ) ;
530+ await ( ( IAsyncDisposable ) this . asyncStream ) . DisposeAsync ( ) . ConfigureAwait ( false ) ;
521531 }
522532
523533 this . cts . Dispose ( ) ;
@@ -526,7 +536,7 @@ protected override async ValueTask DisposeAsync(bool disposing)
526536 finally
527537 {
528538 this . disposed = true ;
529- await base . DisposeAsync ( disposing ) ;
539+ await base . DisposeAsync ( disposing ) . ConfigureAwait ( false ) ;
530540 }
531541 }
532542#else
0 commit comments