-
Notifications
You must be signed in to change notification settings - Fork 234
Fix TEMP debugging #1065
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
Fix TEMP debugging #1065
Conversation
src/PowerShellEditorServices/Services/DebugAdapter/Handlers/ConfigurationDoneHandler.cs
Show resolved
Hide resolved
NOTE: This last commit requires a change in PSRL. |
Marking as ready for review but it does need that PSRL change to go in. |
@@ -291,6 +292,25 @@ public void StartLogging(string logFilePath, PsesLogLevel logLevel) | |||
{ | |||
_logger.LogInformation($"Debug NamedPipe: {config.InOutPipeName}\nDebug OutPipe: {config.OutPipeName}"); | |||
|
|||
IServiceProvider serviceProvider = null; | |||
if (!useExistingSession) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for not using useTempSession
with inverted logic? That would seem to line up with the conceptual feature better to me, and feels like it aligns with "breaking out" of the normal code when the useTempSession
switch is set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's fine - useExistingSession
was just "what was there before"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed it to useTempSession
hopefully that's a bit more clear.
@@ -34,9 +36,10 @@ public class PsesDebugServer : IDisposable | |||
_loggerFactory = factory; | |||
_inputStream = inputStream; | |||
_outputStream = outputStream; | |||
_serverStart = new TaskCompletionSource<bool>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_serverStart = new TaskCompletionSource<bool>(); | |
_serverStarted = new TaskCompletionSource<bool>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gonna change this to _serverRunning
as it will be used to "wait until the server is not running"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed it to that because when the "result is set" it's like saying set the result of the "running". Let me know if you feel stronger about _serverStopped
|
||
public async Task WaitForShutdown() | ||
{ | ||
await _serverStart.Task; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is server start, why does it get set on shutdown? Should it be something like serverStopped
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I guess it should be called like _serverRunning
or something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed it to that because when the "result is set" it's like saying set the result of the "running". Let me know if you feel stronger about _serverStopped
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd personally expect _serverRunning
to complete after initialization. I'm good with _serverStopped
, _serverSession
, _shutdownRequested
anything like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to _serverStopped
!
|
||
namespace Microsoft.PowerShell.EditorServices.Server | ||
{ | ||
internal static class PsesServiceCollection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that this is a static extensions class, maybe call it something like PsesServiceCollectionExtensions
instead (i.e. it doesn't actually implement an collection of services)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of these comments might be outdated, started the review yesterday. If they're no longer applicable just skip em. Mostly nits, otherwise LGTM!
|
||
public async Task WaitForShutdown() | ||
{ | ||
await _serverStart.Task; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd personally expect _serverRunning
to complete after initialization. I'm good with _serverStopped
, _serverSession
, _shutdownRequested
anything like that.
IServiceProvider languageServiceProvider, | ||
PsesDebugServer psesDebugServer, | ||
bool useExistingSession | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: move close paren to previous line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
}); | ||
} | ||
|
||
public static IServiceCollection AddPsesDebugServices ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public static IServiceCollection AddPsesDebugServices ( | |
public static IServiceCollection AddPsesDebugServices( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
_languageServer.WaitForShutdown().Wait(); | ||
if (_languageServer != null) | ||
{ | ||
_languageServer.WaitForShutdown().Wait(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If WaitForShutdown
returns a Task
we should use GetAwaiter().GetResult()
instead of Wait
or Result
. The latter two wrap exceptions in a AggregateException
with a generic message and messes with the stack trace a bit (or rather doesn't fix it).
I know it's existing code, just something we should probably clean up as we see it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
0fcf4d2
to
598bf16
Compare
All feedback addressed and rebased! The can be merged in really at any time it just won't work until PSRL is released. |
This is not being backported. |
This isn't quite ready yet. But I wanted to share what it took.