Skip to content

Commit a5a9915

Browse files
danielmarbachlukebakken
authored andcommitted
DoesNotReturn
1 parent c0aeb42 commit a5a9915

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

projects/RabbitMQ.Client/Impl/AutorecoveringChannel.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
using System;
3333
using System.Collections.Generic;
34+
using System.Diagnostics.CodeAnalysis;
3435
using System.Runtime.CompilerServices;
3536
using System.Threading;
3637
using System.Threading.Tasks;
@@ -489,6 +490,9 @@ private void ThrowIfDisposed()
489490
ThrowDisposed();
490491
}
491492

493+
return;
494+
495+
[DoesNotReturn]
492496
static void ThrowDisposed() => throw new ObjectDisposedException(typeof(AutorecoveringChannel).FullName);
493497
}
494498
}

projects/RabbitMQ.Client/Impl/AutorecoveringConnection.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
using System;
3333
using System.Collections.Generic;
34+
using System.Diagnostics.CodeAnalysis;
3435
using System.Runtime.CompilerServices;
3536
using System.Threading;
3637
using System.Threading.Tasks;
@@ -309,6 +310,9 @@ private void ThrowIfDisposed()
309310
ThrowDisposed();
310311
}
311312

313+
return;
314+
315+
[DoesNotReturn]
312316
static void ThrowDisposed() => throw new ObjectDisposedException(typeof(AutorecoveringConnection).FullName);
313317
}
314318
}

projects/RabbitMQ.Client/Impl/Connection.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
using System;
3333
using System.Collections.Generic;
3434
using System.Diagnostics;
35+
using System.Diagnostics.CodeAnalysis;
3536
using System.IO;
3637
using System.Runtime.CompilerServices;
3738
using System.Threading;
@@ -524,20 +525,21 @@ private void ThrowIfDisposed()
524525
{
525526
if (_disposed)
526527
{
527-
ThrowObjectDisposedException();
528+
ThrowDisposed();
528529
}
529530

530-
static void ThrowObjectDisposedException()
531-
{
532-
throw new ObjectDisposedException(typeof(Connection).FullName);
533-
}
531+
return;
532+
533+
[DoesNotReturn]
534+
static void ThrowDisposed() => throw new ObjectDisposedException(typeof(Connection).FullName);
534535
}
535536

536537
public override string ToString()
537538
{
538539
return $"Connection({_id},{Endpoint})";
539540
}
540541

542+
[DoesNotReturn]
541543
private static void ThrowAlreadyClosedException(ShutdownEventArgs closeReason)
542544
{
543545
throw new AlreadyClosedException(closeReason);

0 commit comments

Comments
 (0)