Skip to content

Commit ebf23ed

Browse files
authored
Throw exception on disposed. We should always throw this one as it is pretty fatal so you would not want this to silently show up in the Exception response value. (#1967)
1 parent ed0bd11 commit ebf23ed

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/RestSharp/RestClient.Async.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ public async Task<RestResponse> ExecuteAsync(RestRequest request, CancellationTo
4949
async Task<InternalResponse> ExecuteInternal(RestRequest request, CancellationToken cancellationToken) {
5050
Ensure.NotNull(request, nameof(request));
5151

52+
// Make sure we are not disposed of when someone tries to call us!
53+
if (_disposed) {
54+
throw new ObjectDisposedException(nameof(RestClient));
55+
}
56+
5257
using var requestContent = new RequestContent(this, request);
5358

5459
if (Authenticator != null) await Authenticator.Authenticate(this, request).ConfigureAwait(false);

0 commit comments

Comments
 (0)