We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent db2753d commit 69798e4Copy full SHA for 69798e4
lib/PuppeteerSharp/Transport/WebSocketTransport.cs
@@ -85,7 +85,16 @@ public Task SendAsync(string message)
85
/// <summary>
86
/// Stops reading incoming data.
87
/// </summary>
88
- public void StopReading() => _readerCancellationSource.Cancel();
+ public void StopReading()
89
+ {
90
+ if (!IsClosed)
91
92
+ // No need to cancel reading if no reading operation is in progress. Moreover,
93
+ // the _readerCancellationSource may already have been disposed, so cancelling
94
+ // it could cause an ObjectDisposedException.
95
+ _readerCancellationSource.Cancel();
96
+ }
97
98
99
100
/// Starts listening the socket
0 commit comments