@@ -299,11 +299,12 @@ private async ValueTask RecoverExchangesAsync(IConnection connection,
299299 {
300300 try
301301 {
302- using ( IChannel ch = await connection . CreateChannelAsync ( cancellationToken : cancellationToken ) . ConfigureAwait ( false ) )
302+ IChannel channel = await connection . CreateChannelAsync ( cancellationToken : cancellationToken ) . ConfigureAwait ( false ) ;
303+ await using ( channel . ConfigureAwait ( false ) )
303304 {
304- await recordedExchange . RecoverAsync ( ch , cancellationToken )
305+ await recordedExchange . RecoverAsync ( channel , cancellationToken )
305306 . ConfigureAwait ( false ) ;
306- await ch . CloseAsync ( cancellationToken )
307+ await channel . CloseAsync ( cancellationToken )
307308 . ConfigureAwait ( false ) ;
308309 }
309310 }
@@ -351,11 +352,12 @@ private async Task RecoverQueuesAsync(IConnection connection,
351352 try
352353 {
353354 string newName = string . Empty ;
354- using ( IChannel ch = await connection . CreateChannelAsync ( cancellationToken : cancellationToken ) . ConfigureAwait ( false ) )
355+ IChannel channel = await connection . CreateChannelAsync ( cancellationToken : cancellationToken ) . ConfigureAwait ( false ) ;
356+ await using ( channel . ConfigureAwait ( false ) )
355357 {
356- newName = await recordedQueue . RecoverAsync ( ch , cancellationToken )
358+ newName = await recordedQueue . RecoverAsync ( channel , cancellationToken )
357359 . ConfigureAwait ( false ) ;
358- await ch . CloseAsync ( cancellationToken )
360+ await channel . CloseAsync ( cancellationToken )
359361 . ConfigureAwait ( false ) ;
360362 }
361363 string oldName = recordedQueue . Name ;
@@ -463,11 +465,12 @@ private async ValueTask RecoverBindingsAsync(IConnection connection,
463465 {
464466 try
465467 {
466- using ( IChannel ch = await connection . CreateChannelAsync ( cancellationToken : cancellationToken ) . ConfigureAwait ( false ) )
468+ IChannel channel = await connection . CreateChannelAsync ( cancellationToken : cancellationToken ) . ConfigureAwait ( false ) ;
469+ await using ( channel . ConfigureAwait ( false ) )
467470 {
468- await binding . RecoverAsync ( ch , cancellationToken )
471+ await binding . RecoverAsync ( channel , cancellationToken )
469472 . ConfigureAwait ( false ) ;
470- await ch . CloseAsync ( cancellationToken )
473+ await channel . CloseAsync ( cancellationToken )
471474 . ConfigureAwait ( false ) ;
472475 }
473476 }
0 commit comments