From 779c94b829d8ded380b31e954cef43fde3dae70f Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Thu, 6 Aug 2026 18:29:58 +0000
Subject: [PATCH 1/2] Initial plan
From 6ce4e84c35afc128449812bd0a901c503c37a573 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Thu, 6 Aug 2026 20:23:26 +0000
Subject: [PATCH 2/2] Remove obsolete IDisposable chain
Co-authored-by: andyleejordan <2226434+andyleejordan@users.noreply.github.com>
---
.../Commands/StartEditorServicesCommand.cs | 2 +-
.../EditorServicesLoader.cs | 18 +++---------------
.../Internal/EditorServicesRunner.cs | 11 +----------
.../Hosting/EditorServicesServerFactory.cs | 5 +----
4 files changed, 6 insertions(+), 30 deletions(-)
diff --git a/src/PowerShellEditorServices.Hosting/Commands/StartEditorServicesCommand.cs b/src/PowerShellEditorServices.Hosting/Commands/StartEditorServicesCommand.cs
index 6f2ec8851..3583d7988 100644
--- a/src/PowerShellEditorServices.Hosting/Commands/StartEditorServicesCommand.cs
+++ b/src/PowerShellEditorServices.Hosting/Commands/StartEditorServicesCommand.cs
@@ -233,7 +233,7 @@ protected override void EndProcessing()
// Create the configuration from parameters
EditorServicesConfig editorServicesConfig = CreateConfigObject();
- using EditorServicesLoader psesLoader = EditorServicesLoader.Create(_logger, editorServicesConfig, SessionDetailsPath, _loggerUnsubscribers);
+ EditorServicesLoader psesLoader = EditorServicesLoader.Create(_logger, editorServicesConfig, SessionDetailsPath, _loggerUnsubscribers);
_logger.Log(PsesLogLevel.Debug, "Loading EditorServices");
// Synchronously start editor services and wait here until it shuts down.
psesLoader.LoadAndRunEditorServicesAsync().GetAwaiter().GetResult();
diff --git a/src/PowerShellEditorServices.Hosting/EditorServicesLoader.cs b/src/PowerShellEditorServices.Hosting/EditorServicesLoader.cs
index eea23353c..0f0fcefa8 100644
--- a/src/PowerShellEditorServices.Hosting/EditorServicesLoader.cs
+++ b/src/PowerShellEditorServices.Hosting/EditorServicesLoader.cs
@@ -29,7 +29,7 @@ namespace Microsoft.PowerShell.EditorServices.Hosting
/// In particular, this class wraps the point where Editor Services is safely loaded
/// in a way that separates its dependencies from the calling context.
///
- public sealed class EditorServicesLoader : IDisposable
+ public sealed class EditorServicesLoader
{
#if !CoreCLR
// TODO: Well, we're saying we need 4.8 here but we're building for 4.6.2...
@@ -172,8 +172,6 @@ public static EditorServicesLoader Create(
private readonly Version _powerShellVersion;
- private EditorServicesRunner _editorServicesRunner;
-
private EditorServicesLoader(
HostLogger logger,
EditorServicesConfig hostConfig,
@@ -217,20 +215,10 @@ public Task LoadAndRunEditorServicesAsync()
_logger.Log(PsesLogLevel.Information, "Starting PowerShell Editor Services");
- _editorServicesRunner = new EditorServicesRunner(_logger, _hostConfig, _sessionFileWriter, _loggersToUnsubscribe);
+ EditorServicesRunner editorServicesRunner = new(_logger, _hostConfig, _sessionFileWriter, _loggersToUnsubscribe);
// The trigger method for Editor Services
- return Task.Run(_editorServicesRunner.RunUntilShutdown);
- }
-
- public void Dispose()
- {
- _logger.Log(PsesLogLevel.Trace, "Loader disposed");
- _editorServicesRunner?.Dispose();
-
- // TODO:
- // Remove assembly resolve events
- // This is not high priority, since the PSES process shouldn't be reused
+ return Task.Run(editorServicesRunner.RunUntilShutdown);
}
private static void LoadEditorServices() =>
diff --git a/src/PowerShellEditorServices.Hosting/Internal/EditorServicesRunner.cs b/src/PowerShellEditorServices.Hosting/Internal/EditorServicesRunner.cs
index 5d8c368c9..19a0bea6a 100644
--- a/src/PowerShellEditorServices.Hosting/Internal/EditorServicesRunner.cs
+++ b/src/PowerShellEditorServices.Hosting/Internal/EditorServicesRunner.cs
@@ -18,7 +18,7 @@ namespace Microsoft.PowerShell.EditorServices.Hosting
/// cref="Microsoft.Extensions.Logging"/> and .
///
- internal class EditorServicesRunner : IDisposable
+ internal class EditorServicesRunner
{
private readonly HostLogger _logger;
@@ -68,15 +68,6 @@ public Task RunUntilShutdown()
return runAndAwaitShutdown;
}
- ///
- /// TODO: This class probably should not be as the primary
- /// intention of that interface is to provide cleanup of unmanaged resources, which the
- /// logger certainly is not. Nor is this class used with a . It is
- /// only because of the use of that this class is also
- /// disposable, and instead that class should be fixed.
- ///
- public void Dispose() => _serverFactory.Dispose();
-
///
/// This is the servers' entry point, e.g. main, as it instantiates, runs and waits
/// for the LSP and debug servers at the heart of Editor Services. Uses
/// Factory for creating the LSP server and debug server instances.
///
- internal sealed class EditorServicesServerFactory : IDisposable
+ internal sealed class EditorServicesServerFactory
{
private readonly HostLogger _hostLogger;
@@ -125,8 +125,5 @@ public PsesDebugServer CreateDebugServerForTempSession(
serviceProvider,
isTemp: true);
}
-
- // TODO: Clean up host logger? Shouldn't matter since we start a new process after shutdown.
- public void Dispose() { }
}
}