MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / DisposeAsync

Method DisposeAsync

dotnet/src/webdriver/BiDi/Subscription.cs:84–116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

82 }
83
84 public async ValueTask DisposeAsync()
85 {
86 if (Interlocked.CompareExchange(ref _disposed, 1, 0) == 0)
87 {
88 Exception? unsubscribeError = null;
89
90 try
91 {
92 await _unsubscribe(default).ConfigureAwait(false);
93 }
94 catch (Exception ex)
95 {
96 _logger.Warn($"Wire unsubscribe failed during dispose: {ex.Message}");
97 unsubscribeError = ex;
98 }
99 finally
100 {
101 _channel.Writer.TryComplete();
102
103 await _dispatchTask.ConfigureAwait(false);
104
105 GC.SuppressFinalize(this);
106 }
107
108 _handlerError?.Throw();
109 _sourceError?.Throw();
110
111 if (unsubscribeError is not null)
112 {
113 ExceptionDispatchInfo.Capture(unsubscribeError).Throw();
114 }
115 }
116 }
117
118 private async Task DispatchEventsAsync()
119 {

Callers

nothing calls this directly

Calls 1

WarnMethod · 0.45

Tested by

no test coverage detected