Skip to content

Commit

Permalink
Fix ObjectDisposedException message
Browse files Browse the repository at this point in the history
The call to ObjectDisposedThrowHelper.ThrowIf expects an instance or a type. This code was passing a name, which resulted in an error message resembling:

System.ObjectDisposedException : Cannot access a disposed object.
Object name: 'System.String'.
  • Loading branch information
drewnoakes authored and JamesNK committed Apr 17, 2024
1 parent 9cd97ce commit 6ee177e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Grpc.Net.Client/GrpcChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ internal void RegisterActiveCall(IDisposable grpcCall)
{
// Test the disposed flag inside the lock to ensure there is no chance of a race and adding a call after dispose.
// Note that a GrpcCall has been created but hasn't been started. The error will prevent it from starting.
ObjectDisposedThrowHelper.ThrowIf(Disposed, nameof(GrpcChannel));
ObjectDisposedThrowHelper.ThrowIf(Disposed, typeof(GrpcChannel));

_activeCalls.Add(grpcCall);
}
Expand Down

0 comments on commit 6ee177e

Please sign in to comment.