Skip to content
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

Always log LSP server processId and increase attach timeout #72531

Merged
merged 1 commit into from
Mar 14, 2024
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 @@ -57,6 +57,7 @@ static async Task RunAsync(ServerConfiguration serverConfiguration, Cancellation

var logger = loggerFactory.CreateLogger<Program>();

logger.Log(serverConfiguration.LaunchDebugger ? LogLevel.Critical : LogLevel.Trace, "Server started with process ID {processId}", Environment.ProcessId);
if (serverConfiguration.LaunchDebugger)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
Expand All @@ -66,8 +67,7 @@ static async Task RunAsync(ServerConfiguration serverConfiguration, Cancellation
}
else
{
var timeout = TimeSpan.FromMinutes(1);
logger.LogCritical($"Server started with process ID {Environment.ProcessId}");
var timeout = TimeSpan.FromMinutes(2);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How to attach debugger on a non-win platform?🤔 Use C# extenstions to debug itself?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup - I do it often on my mac. There's an attach to process command to attach to any dotnet core process

logger.LogCritical($"Waiting {timeout:g} for a debugger to attach");
using var timeoutSource = new CancellationTokenSource(timeout);
while (!Debugger.IsAttached && !timeoutSource.Token.IsCancellationRequested)
Expand Down
Loading