Skip to content

Remove suppression and fix VSTHRD100 #78373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 30, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.Threading;
using StreamJsonRpc;

namespace Microsoft.CommonLanguageServerProtocol.Framework;
Expand Down Expand Up @@ -326,18 +327,21 @@ private ValueTask ShutdownRequestExecutionQueueAsync()
return queue.DisposeAsync();
}

#pragma warning disable VSTHRD100
/// <summary>
/// Cleanup the server if we encounter a json rpc disconnect so that we can be restarted later.
/// </summary>
private async void JsonRpc_Disconnected(object? sender, JsonRpcDisconnectedEventArgs e)
private void JsonRpc_Disconnected(object? sender, JsonRpcDisconnectedEventArgs e)
{
// It is possible this gets called during normal shutdown and exit.
// ShutdownAsync and ExitAsync will no-op if shutdown was already triggered by something else.
await ShutdownAsync(message: "Shutdown triggered by JsonRpc disconnect").ConfigureAwait(false);
await ExitAsync().ConfigureAwait(false);
JsonRpc_DisconnectedAsync(sender, e).Forget();

async Task JsonRpc_DisconnectedAsync(object? sender, JsonRpcDisconnectedEventArgs e)
{
// It is possible this gets called during normal shutdown and exit.
// ShutdownAsync and ExitAsync will no-op if shutdown was already triggered by something else.
await ShutdownAsync(message: "Shutdown triggered by JsonRpc disconnect").ConfigureAwait(false);
await ExitAsync().ConfigureAwait(false);
}
}
#pragma warning disable VSTHRD100

internal TestAccessor GetTestAccessor()
{
Expand Down
Loading