@@ -299,11 +299,12 @@ private async ValueTask RecoverExchangesAsync(IConnection connection,
299
299
{
300
300
try
301
301
{
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 ) )
303
304
{
304
- await recordedExchange . RecoverAsync ( ch , cancellationToken )
305
+ await recordedExchange . RecoverAsync ( channel , cancellationToken )
305
306
. ConfigureAwait ( false ) ;
306
- await ch . CloseAsync ( cancellationToken )
307
+ await channel . CloseAsync ( cancellationToken )
307
308
. ConfigureAwait ( false ) ;
308
309
}
309
310
}
@@ -351,11 +352,12 @@ private async Task RecoverQueuesAsync(IConnection connection,
351
352
try
352
353
{
353
354
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 ) )
355
357
{
356
- newName = await recordedQueue . RecoverAsync ( ch , cancellationToken )
358
+ newName = await recordedQueue . RecoverAsync ( channel , cancellationToken )
357
359
. ConfigureAwait ( false ) ;
358
- await ch . CloseAsync ( cancellationToken )
360
+ await channel . CloseAsync ( cancellationToken )
359
361
. ConfigureAwait ( false ) ;
360
362
}
361
363
string oldName = recordedQueue . Name ;
@@ -463,11 +465,12 @@ private async ValueTask RecoverBindingsAsync(IConnection connection,
463
465
{
464
466
try
465
467
{
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 ) )
467
470
{
468
- await binding . RecoverAsync ( ch , cancellationToken )
471
+ await binding . RecoverAsync ( channel , cancellationToken )
469
472
. ConfigureAwait ( false ) ;
470
- await ch . CloseAsync ( cancellationToken )
473
+ await channel . CloseAsync ( cancellationToken )
471
474
. ConfigureAwait ( false ) ;
472
475
}
473
476
}
0 commit comments