Skip to content

Commit e4f9130

Browse files
committed
Ignore intentional sync aways in Dispose methods
1 parent b17e5a3 commit e4f9130

File tree

10 files changed

+23
-8
lines changed

10 files changed

+23
-8
lines changed

src/PowerShellEditorServices/Server/PsesServiceCollectionExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ public static IServiceCollection AddPsesLanguageServices(
4848
// is ready, it will be available. NOTE: We cannot await this because it
4949
// uses a lazy initialization to avoid a race with the dependency injection
5050
// framework, see the EditorObject class for that!
51+
#pragma warning disable VSTHRD110
5152
extensionService.InitializeAsync();
52-
53+
#pragma warning restore VSTHRD110
5354
return extensionService;
5455
})
5556
.AddSingleton<AnalysisService>();

src/PowerShellEditorServices/Services/DebugAdapter/Handlers/LaunchAndAttachHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ await _executionService.ExecutePSCommandAsync(
453453
// PSES sends the initialized event at the end of the Launch/Attach handler
454454

455455
// The way that the Omnisharp server works is that this OnStarted handler runs after OnInitialized
456-
// (after the Initialize DAP response is sent to the client) but before the _Initalized_ DAP event
456+
// (after the Initialize DAP response is sent to the client) but before the _Initialized_ DAP event
457457
// gets sent to the client. Because of the way PSES handles breakpoints,
458458
// we can't send the Initialized event until _after_ we finish the Launch/Attach handler.
459459
// The flow above depicts this. To achieve this, we wait until _debugStateService.ServerStarted

src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellContextFrame.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ protected virtual void Dispose(bool disposing)
7979
public void Dispose()
8080
{
8181
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
82-
Dispose(disposing: true);
82+
Dispose(true);
8383
GC.SuppressFinalize(this);
8484
}
8585

src/PowerShellEditorServices/Services/PowerShell/Context/PowerShellVersionDetails.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
using Microsoft.Extensions.Logging;
5-
using Microsoft.PowerShell.EditorServices.Services.PowerShell.Utility;
64
using System;
75
using System.Collections;
86
using System.Linq;
7+
using Microsoft.Extensions.Logging;
8+
using Microsoft.PowerShell.EditorServices.Services.PowerShell.Utility;
99

1010
namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Context
1111
{
@@ -91,7 +91,7 @@ public PowerShellVersionDetails(
9191
/// Gets the PowerShell version details for the given runspace.
9292
/// </summary>
9393
/// <param name="logger">An ILogger implementation used for writing log messages.</param>
94-
/// <param name="pwsh">The PowerShell instance for which to to get the version.</param>
94+
/// <param name="pwsh">The PowerShell instance for which to get the version.</param>
9595
/// <returns>A new PowerShellVersionDetails instance.</returns>
9696
public static PowerShellVersionDetails GetVersionDetails(ILogger logger, PowerShell pwsh)
9797
{

test/PowerShellEditorServices.Test.E2E/Processes/ServerProcess.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected ServerProcess(ILoggerFactory loggerFactory)
4343
}
4444

4545
/// <summary>
46-
/// Finaliser for <see cref="ServerProcess"/>.
46+
/// Finalizer for <see cref="ServerProcess"/>.
4747
/// </summary>
4848
~ServerProcess()
4949
{
@@ -53,7 +53,11 @@ protected ServerProcess(ILoggerFactory loggerFactory)
5353
/// <summary>
5454
/// Dispose of resources being used by the launcher.
5555
/// </summary>
56-
public void Dispose() => Dispose(true);
56+
public void Dispose()
57+
{
58+
Dispose(true);
59+
GC.SuppressFinalize(this);
60+
}
5761

5862
/// <summary>
5963
/// Dispose of resources being used by the launcher.

test/PowerShellEditorServices.Test/Debugging/DebugServiceTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ public void Dispose()
6363
{
6464
debugService.Abort();
6565
debuggerStoppedQueue.Dispose();
66+
#pragma warning disable VSTHRD002
6667
psesHost.StopAsync().Wait();
68+
#pragma warning restore VSTHRD002
6769
GC.SuppressFinalize(this);
6870
}
6971

test/PowerShellEditorServices.Test/Extensions/ExtensionCommandTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ public ExtensionCommandTests()
3939

4040
public void Dispose()
4141
{
42+
#pragma warning disable VSTHRD002
4243
psesHost.StopAsync().Wait();
44+
#pragma warning restore VSTHRD002
4345
GC.SuppressFinalize(this);
4446
}
4547

test/PowerShellEditorServices.Test/Language/CompletionHandlerTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ public CompletionHandlerTests()
3535

3636
public void Dispose()
3737
{
38+
#pragma warning disable VSTHRD002
3839
psesHost.StopAsync().Wait();
40+
#pragma warning restore VSTHRD002
3941
GC.SuppressFinalize(this);
4042
}
4143

test/PowerShellEditorServices.Test/Language/SymbolsServiceTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ public SymbolsServiceTests()
4646

4747
public void Dispose()
4848
{
49+
#pragma warning disable VSTHRD002
4950
psesHost.StopAsync().GetAwaiter().GetResult();
51+
#pragma warning restore VSTHRD002
5052
CommandHelpers.s_cmdletToAliasCache.Clear();
5153
CommandHelpers.s_aliasToCmdletCache.Clear();
5254
GC.SuppressFinalize(this);

test/PowerShellEditorServices.Test/Session/PsesInternalHostTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ public class PsesInternalHostTests : IDisposable
2727

2828
public void Dispose()
2929
{
30+
#pragma warning disable VSTHRD002
3031
psesHost.StopAsync().Wait();
32+
#pragma warning restore VSTHRD002
3133
GC.SuppressFinalize(this);
3234
}
3335

0 commit comments

Comments
 (0)