Skip to content

Commit 7d864df

Browse files
committed
Merge pull request #69 from PowerShell/daviwil/fix-debug-hang
Fix hang when debug adapter finishes executing
2 parents ae3ad45 + 7d61207 commit 7d864df

File tree

9 files changed

+33
-9
lines changed

9 files changed

+33
-9
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ lock
2424
/target
2525
.corext/gen
2626
registered_data.ini
27-
27+
.vs/
2828

2929
# quickbuild.exe
3030
/VersionGeneratingLogs/

appveyor.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ build:
3636
test:
3737
assemblies:
3838
- Microsoft.PowerShell.EditorServices.Test.dll
39+
- Microsoft.PowerShell.EditorServices.Test.Protocol.dll
3940
- Microsoft.PowerShell.EditorServices.Test.Host.dll
40-
- Microsoft.PowerShell.EditorServices.Test.Transport.Stdio.dll

src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs

+11
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@ protected override void Initialize()
5656
this.SetRequestHandler(EvaluateRequest.Type, this.HandleEvaluateRequest);
5757
}
5858

59+
protected override void Shutdown()
60+
{
61+
Logger.Write(LogLevel.Normal, "Debug adapter is shutting down...");
62+
63+
if (this.editorSession != null)
64+
{
65+
this.editorSession.Dispose();
66+
this.editorSession = null;
67+
}
68+
}
69+
5970
#region Built-in Message Handlers
6071

6172
protected async Task HandleLaunchRequest(

src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ protected override void Shutdown()
7070
{
7171
Logger.Write(LogLevel.Normal, "Language service is shutting down...");
7272

73-
this.editorSession.Dispose();
73+
if (this.editorSession != null)
74+
{
75+
this.editorSession.Dispose();
76+
this.editorSession = null;
77+
}
7478
}
7579

7680
#region Built-in Message Handlers

test/PowerShellEditorServices.Test.Host/PowerShellEditorServices.Test.Host.csproj

+3
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@
8484
<None Include="TestFiles\SimpleSyntaxError.ps1">
8585
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
8686
</None>
87+
<None Include="xunit.runner.json">
88+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
89+
</None>
8790
</ItemGroup>
8891
<ItemGroup>
8992
<Reference Include="envdte, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"parallelizeTestCollections": false,
3+
"methodDisplay": "method"
4+
}

test/PowerShellEditorServices.Test/Debugging/DebugServiceTests.cs

+1-6
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,7 @@ void debugService_BreakpointUpdated(object sender, BreakpointUpdatedEventArgs e)
6161

6262
void debugService_DebuggerStopped(object sender, DebuggerStopEventArgs e)
6363
{
64-
this.runnerContext.Post(
65-
(o) =>
66-
{
67-
this.debuggerStoppedQueue.Enqueue(e);
68-
}, null);
64+
this.debuggerStoppedQueue.Enqueue(e);
6965
}
7066

7167
public void Dispose()
@@ -119,7 +115,6 @@ await this.debugService.SetBreakpoints(
119115
this.debugService.Continue();
120116

121117
await this.AssertDebuggerStopped(this.debugScriptFile.FilePath, 9);
122-
this.debugService.Continue();
123118

124119
// Abort script execution early and wait for completion
125120
this.debugService.Abort();

test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj

+3
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@
8787
<ItemGroup>
8888
<None Include="App.config" />
8989
<None Include="packages.config" />
90+
<None Include="xunit.runner.json">
91+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
92+
</None>
9093
</ItemGroup>
9194
<ItemGroup>
9295
<ProjectReference Include="..\..\src\PowerShellEditorServices\PowerShellEditorServices.csproj">
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"parallelizeTestCollections": false,
3+
"methodDisplay": "method"
4+
}

0 commit comments

Comments
 (0)