Skip to content

Commit f5b644e

Browse files
committed
Remove unneeded PSRL static ctor call - PSRL is now loaded on the pipeline thread
1 parent 963fba1 commit f5b644e

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

src/PowerShellEditorServices/Server/PsesDebugServer.cs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
using Microsoft.PowerShell.EditorServices.Services.PowerShell.Debugging;
1515
using Microsoft.PowerShell.EditorServices.Services.PowerShell.Host;
1616
using Microsoft.PowerShell.EditorServices.Services.PowerShell.Runspace;
17+
using Microsoft.PowerShell.EditorServices.Utility;
1718
using OmniSharp.Extensions.DebugAdapter.Server;
1819
using OmniSharp.Extensions.LanguageServer.Server;
1920

@@ -27,7 +28,7 @@ internal class PsesDebugServer : IDisposable
2728
/// <summary>
2829
/// This is a bool but must be an int, since Interlocked.Exchange can't handle a bool
2930
/// </summary>
30-
private static int s_hasRunPsrlStaticCtor = 0;
31+
private static readonly IdempotentLatch s_psrlCtorLatch = new();
3132

3233
private static readonly Lazy<CmdletInfo> s_lazyInvokeReadLineConstructorCmdletInfo = new Lazy<CmdletInfo>(() =>
3334
{
@@ -79,22 +80,6 @@ public async Task StartAsync()
7980
_debugContext = ServiceProvider.GetService<PsesInternalHost>().DebugContext;
8081
_debugContext.IsDebugServerActive = true;
8182

82-
/*
83-
// Needed to make sure PSReadLine's static properties are initialized in the pipeline thread.
84-
// This is only needed for Temp sessions who only have a debug server.
85-
if (_usePSReadLine && _useTempSession && Interlocked.Exchange(ref s_hasRunPsrlStaticCtor, 1) == 0)
86-
{
87-
// This must be run synchronously to ensure debugging works
88-
_executionService
89-
.ExecuteDelegateAsync((cancellationToken) =>
90-
{
91-
// Is this needed now that we do things the cool way??
92-
}, "PSRL static constructor execution", CancellationToken.None)
93-
.GetAwaiter()
94-
.GetResult();
95-
}
96-
*/
97-
9883
options
9984
.WithInput(_inputStream)
10085
.WithOutput(_outputStream)

0 commit comments

Comments
 (0)