Skip to content

Commit b76b070

Browse files
committed
True fire-and-forget
1 parent 6654dc1 commit b76b070

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/EditorFeatures/Core/LanguageServer/AlwaysActiveLanguageClientEventListener.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ private void Load()
7373

7474
async Task LoadAsync()
7575
{
76-
7776
// Explicitly switch to the bg so that if this causes any expensive work (like mef loads) it
7877
// doesn't block the UI thread. Note, we always yield because sometimes our caller starts
7978
// on the threadpool thread but is indirectly blocked on by the UI thread.
@@ -90,13 +89,10 @@ await _languageClientBroker.Value.LoadAsync(new LanguageClientMetadata(
9089

9190
private void Unload()
9291
{
93-
using var token = _asynchronousOperationListener.BeginAsyncOperation(nameof(Unload));
94-
UnloadAsync().ReportNonFatalErrorAsync().CompletesAsyncOperation(token);
95-
96-
async Task UnloadAsync()
97-
{
98-
await _languageClient.StopServerAsync().ConfigureAwait(false);
99-
}
92+
// We just want to signal that an unload should happen, in case the above call to Load comes in quick.
93+
// We don't want to wait for it to complete, not do we care about errors that may occur during the unload.
94+
// The language client/server does its own error reporting as necessary.
95+
_languageClient.StopServerAsync().Forget();
10096
}
10197

10298
/// <summary>

0 commit comments

Comments
 (0)