Skip to content

Commit a56e110

Browse files
authored
Rename canceled exception property on channel (#490)
1 parent 2b1ad6d commit a56e110

12 files changed

+17
-17
lines changed

src/Grpc.Net.Client/GrpcChannel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public sealed class GrpcChannel : ChannelBase, IDisposable
4545
internal int? SendMaxMessageSize { get; }
4646
internal int? ReceiveMaxMessageSize { get; }
4747
internal ILoggerFactory LoggerFactory { get; }
48-
internal bool ThrowOperationCanceledExceptionOnCancellation { get; }
48+
internal bool ThrowOperationCanceledOnCancellation { get; }
4949
internal bool? IsSecure { get; }
5050
internal List<CallCredentials>? CallCredentials { get; }
5151
internal Dictionary<string, ICompressionProvider> CompressionProviders { get; }
@@ -72,7 +72,7 @@ internal GrpcChannel(Uri address, GrpcChannelOptions channelOptions) : base(addr
7272
CompressionProviders = ResolveCompressionProviders(channelOptions.CompressionProviders);
7373
MessageAcceptEncoding = GrpcProtocolHelpers.GetMessageAcceptEncoding(CompressionProviders);
7474
LoggerFactory = channelOptions.LoggerFactory ?? NullLoggerFactory.Instance;
75-
ThrowOperationCanceledExceptionOnCancellation = channelOptions.ThrowOperationCanceledExceptionOnCancellation;
75+
ThrowOperationCanceledOnCancellation = channelOptions.ThrowOperationCanceledOnCancellation;
7676

7777
if (channelOptions.Credentials != null)
7878
{

src/Grpc.Net.Client/GrpcChannelOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public sealed class GrpcChannelOptions
8282
/// The default value is <c>false</c>.
8383
/// Note: experimental API that can change or be removed without any prior notice.
8484
/// </summary>
85-
public bool ThrowOperationCanceledExceptionOnCancellation { get; set; }
85+
public bool ThrowOperationCanceledOnCancellation { get; set; }
8686

8787
/// <summary>
8888
/// Initializes a new instance of the <see cref="GrpcChannelOptions"/> class.

src/Grpc.Net.Client/Internal/GrpcCall.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ public async Task<Metadata> GetResponseHeadersAsync()
249249
return GrpcProtocolHelpers.BuildMetadata(HttpResponse.Headers);
250250
}
251251
}
252-
catch (OperationCanceledException) when (!Channel.ThrowOperationCanceledExceptionOnCancellation)
252+
catch (OperationCanceledException) when (!Channel.ThrowOperationCanceledOnCancellation)
253253
{
254254
throw CreateCanceledStatusException();
255255
}
@@ -322,7 +322,7 @@ public async Task<TResponse> GetResponseAsync()
322322
return message;
323323
}
324324
}
325-
catch (OperationCanceledException) when (!Channel.ThrowOperationCanceledExceptionOnCancellation)
325+
catch (OperationCanceledException) when (!Channel.ThrowOperationCanceledOnCancellation)
326326
{
327327
throw CreateCanceledStatusException();
328328
}

src/Grpc.Net.Client/Internal/HttpContentClientStreamReader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public Task<bool> MoveNext(CancellationToken cancellationToken)
6363
// HTTP response has finished
6464
if (_call.CancellationToken.IsCancellationRequested)
6565
{
66-
if (!_call.Channel.ThrowOperationCanceledExceptionOnCancellation)
66+
if (!_call.Channel.ThrowOperationCanceledOnCancellation)
6767
{
6868
return Task.FromException<bool>(_call.CreateCanceledStatusException());
6969
}
@@ -177,7 +177,7 @@ private async Task<bool> MoveNextCore(CancellationToken cancellationToken)
177177
GrpcEventSource.Log.MessageReceived();
178178
return true;
179179
}
180-
catch (OperationCanceledException) when (!_call.Channel.ThrowOperationCanceledExceptionOnCancellation)
180+
catch (OperationCanceledException) when (!_call.Channel.ThrowOperationCanceledOnCancellation)
181181
{
182182
throw _call.CreateCanceledStatusException();
183183
}

src/Grpc.Net.Client/Internal/HttpContentClientStreamWriter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public Task WriteAsync(TRequest message)
9494
// Call has been canceled
9595
if (_call.CancellationToken.IsCancellationRequested)
9696
{
97-
if (!_call.Channel.ThrowOperationCanceledExceptionOnCancellation)
97+
if (!_call.Channel.ThrowOperationCanceledOnCancellation)
9898
{
9999
return Task.FromException(_call.CreateCanceledStatusException());
100100
}
@@ -167,7 +167,7 @@ await writeStream.WriteMessageAsync<TRequest>(
167167

168168
GrpcEventSource.Log.MessageSent();
169169
}
170-
catch (OperationCanceledException) when (!_call.Channel.ThrowOperationCanceledExceptionOnCancellation)
170+
catch (OperationCanceledException) when (!_call.Channel.ThrowOperationCanceledOnCancellation)
171171
{
172172
throw _call.CreateCanceledStatusException();
173173
}

test/Grpc.Net.Client.Tests/AsyncClientStreamingCallTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ public async Task ClientStreamWriter_CancelledBeforeCallStarts_ThrowOperationCan
270270
{
271271
return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.OK));
272272
});
273-
var invoker = HttpClientCallInvokerFactory.Create(httpClient, configure: o => o.ThrowOperationCanceledExceptionOnCancellation = true);
273+
var invoker = HttpClientCallInvokerFactory.Create(httpClient, configure: o => o.ThrowOperationCanceledOnCancellation = true);
274274

275275
// Act
276276
var call = invoker.AsyncClientStreamingCall<HelloRequest, HelloReply>(ClientTestHelpers.ServiceMethod, string.Empty, new CallOptions(cancellationToken: new CancellationToken(true)));

test/Grpc.Net.Client.Tests/CancellationTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public async Task AsyncClientStreamingCall_CancellationDuringSend_ThrowOperation
8181
{
8282
// Arrange
8383
var cts = new CancellationTokenSource();
84-
var invoker = CreateTimedoutCallInvoker(configure: o => o.ThrowOperationCanceledExceptionOnCancellation = true);
84+
var invoker = CreateTimedoutCallInvoker(configure: o => o.ThrowOperationCanceledOnCancellation = true);
8585

8686
// Act
8787
var call = invoker.AsyncClientStreamingCall<HelloRequest, HelloReply>(ClientTestHelpers.ServiceMethod, string.Empty, new CallOptions(cancellationToken: cts.Token));
@@ -102,7 +102,7 @@ public async Task AsyncClientStreamingCall_CancellationDuringSend_ThrowOperation
102102
{
103103
// Arrange
104104
var cts = new CancellationTokenSource();
105-
var invoker = CreateTimedoutCallInvoker(configure: o => o.ThrowOperationCanceledExceptionOnCancellation = true);
105+
var invoker = CreateTimedoutCallInvoker(configure: o => o.ThrowOperationCanceledOnCancellation = true);
106106

107107
// Act
108108
var call = invoker.AsyncClientStreamingCall<HelloRequest, HelloReply>(ClientTestHelpers.ServiceMethod, string.Empty, new CallOptions(cancellationToken: cts.Token));

test/Grpc.Net.Client.Tests/DeadlineTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public async Task AsyncClientStreamingCall_DeadlineDuringSend_ThrowOperationCanc
155155
return ResponseUtils.CreateResponse(HttpStatusCode.OK);
156156
});
157157
var testSystemClock = new TestSystemClock(DateTime.UtcNow);
158-
var invoker = HttpClientCallInvokerFactory.Create(httpClient, systemClock: testSystemClock, configure: o => o.ThrowOperationCanceledExceptionOnCancellation = true);
158+
var invoker = HttpClientCallInvokerFactory.Create(httpClient, systemClock: testSystemClock, configure: o => o.ThrowOperationCanceledOnCancellation = true);
159159

160160
// Act
161161
var call = invoker.AsyncClientStreamingCall<HelloRequest, HelloReply>(ClientTestHelpers.ServiceMethod, string.Empty, new CallOptions(deadline: testSystemClock.UtcNow.AddSeconds(0.5)));

test/Grpc.Net.Client.Tests/HttpContentClientStreamReaderTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public async Task MoveNext_TokenCanceledDuringCall_ThrowOperationCanceledExcepti
103103
return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.OK, content));
104104
});
105105

106-
var channel = GrpcChannel.ForAddress(httpClient.BaseAddress, new GrpcChannelOptions { HttpClient = httpClient, ThrowOperationCanceledExceptionOnCancellation = true });
106+
var channel = GrpcChannel.ForAddress(httpClient.BaseAddress, new GrpcChannelOptions { HttpClient = httpClient, ThrowOperationCanceledOnCancellation = true });
107107
var call = new GrpcCall<HelloRequest, HelloReply>(ClientTestHelpers.ServiceMethod, new CallOptions(), channel);
108108
call.StartServerStreaming(new HelloRequest());
109109

test/Grpc.Net.Client.Tests/ReadAllAsyncTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public async Task MoveNextAsync_CancelCall_ThrowOperationCanceledExceptionOnCanc
205205

206206
return ResponseUtils.CreateResponse(HttpStatusCode.OK, streamContent);
207207
});
208-
var invoker = HttpClientCallInvokerFactory.Create(httpClient, configure: o => o.ThrowOperationCanceledExceptionOnCancellation = true);
208+
var invoker = HttpClientCallInvokerFactory.Create(httpClient, configure: o => o.ThrowOperationCanceledOnCancellation = true);
209209
var cts = new CancellationTokenSource();
210210

211211
// Act

0 commit comments

Comments
 (0)