Skip to content

Commit af69922

Browse files
committed
Fix.
1 parent 5a90f4a commit af69922

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/Components/Components/src/OwningComponentBase.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected IServiceProvider ScopedServices
4444
}
4545
}
4646

47-
/// <inhertidoc />
47+
/// <inheritdoc />
4848
void IDisposable.Dispose()
4949
{
5050
Dispose(disposing: true);
@@ -69,12 +69,15 @@ protected virtual void Dispose(bool disposing)
6969
}
7070
}
7171

72-
/// <inhertidoc />
72+
/// <inheritdoc />
7373
async ValueTask IAsyncDisposable.DisposeAsync()
7474
{
75-
await DisposeAsyncCore().ConfigureAwait(false);
76-
77-
Dispose(disposing: false);
75+
if (!IsDisposed)
76+
{
77+
await DisposeAsyncCore().ConfigureAwait(false);
78+
79+
Dispose(disposing: true);
80+
}
7881
GC.SuppressFinalize(this);
7982
}
8083

@@ -84,13 +87,11 @@ async ValueTask IAsyncDisposable.DisposeAsync()
8487
/// <returns>A task that represents the asynchronous dispose operation.</returns>
8588
protected virtual async ValueTask DisposeAsyncCore()
8689
{
87-
if (!IsDisposed && _scope.HasValue)
90+
if (_scope.HasValue)
8891
{
8992
await _scope.Value.DisposeAsync().ConfigureAwait(false);
9093
_scope = null;
9194
}
92-
93-
IsDisposed = true;
9495
}
9596
}
9697

0 commit comments

Comments
 (0)