in src/PortingAssistantExtensionClientShared/PortingAssistantLanguageClient.cs [129:176]
public async Task<Connection> ActivateAsync(CancellationToken token)
{
await Task.Yield();
try
{
UserSettings.Instance.SetLanguageServerStatus(LanguageServerStatus.STARTING);
var stdInPipeName = Common.Constants.DebugInPipeName;
var stdOutPipeName = Common.Constants.DebugOutPipeName;
#if DEBUG
var (debugreaderPipe, debugwriterPipe) = CreateConnectionPipe(stdInPipeName, stdOutPipeName);
await debugreaderPipe.WaitForConnectionAsync(token).ConfigureAwait(true);
await debugwriterPipe.WaitForConnectionAsync(token).ConfigureAwait(true);
return new Connection(debugreaderPipe, debugwriterPipe);
#endif
stdInPipeName = $"{Common.Constants.InPipeName}{LaunchTime}";
stdOutPipeName = $"{Common.Constants.OutPipeName}{LaunchTime}";
var extensionVersion = GetExtensionVersion();
var clientVersion = GetVisualStudioVersion();
var (readerPipe, writerPipe) = CreateConnectionPipe(stdInPipeName, stdOutPipeName);
if (File.Exists(LanguageServerPath))
{
ProcessStartInfo info = new ProcessStartInfo()
{
FileName = LanguageServerPath,
WorkingDirectory = Path.GetDirectoryName(LanguageServerPath),
UseShellExecute = false,
CreateNoWindow = true,
Arguments = $"{ConfigurationPath} {stdOutPipeName} {stdInPipeName} {extensionVersion} {clientVersion}"
};
Process process = new Process { StartInfo = info };
if (process.Start())
{
await readerPipe.WaitForConnectionAsync(token).ConfigureAwait(true);
await writerPipe.WaitForConnectionAsync(token).ConfigureAwait(true);
return new Connection(readerPipe, writerPipe);
}
}
return null;
}
catch (Exception e)
{
Trace.WriteLine($"Failed to activate server. {e}");
throw;
}
}