Skip to content

Commit 64d5caf

Browse files
CopilotCopilot
authored andcommitted
Update .NET SDK to 10.0 and PowerShell to 7.6.3
Retarget the Hosting and Test projects from `net8.0` to `net10.0` (the new LTS), pin `global.json` to the 10.0.301 SDK, and move `Microsoft.PowerShell.SDK` from 7.4.14 to 7.6.3 — the PowerShell 7.6 LTS line that aligns with .NET 10, mirroring how 7.4 aligned with .NET 8. The .NET 10 SDK ships newer Roslyn analyzers that we enforce as build errors (`EnforceCodeStyleInBuild`), so a few pre-existing constructs needed cleanup to stay green: - `VersionUtils.IsPS74` matched *exactly* 7.4, but the variable-completion detail it gates was added in 7.4 and persists in 7.6. It now reads `IsPS74OrGreater` (>= 7.4); without it the `CompletesVariableInFile` test fails on 7.6. - Removed the unused `_workspaceService` field and constructor parameter from `ReferencesCodeLensProvider` — dead since we removed the notion of referenced files (IDE0052). - Adopted the C# 14 `field` keyword in `SynchronousTask.Result` and `ReferenceTable.IsInitialized` (IDE0032), null-conditional assignment in `PowerShellDebugContext` and `RemoteFileManagerService` (IDE0031), dropped redundant interface accessibility modifiers (IDE0040), and simplified a `TextEdit` reference. `LangVersion` is `latest`, which is now C# 14. I built core (`netstandard2.0`), Hosting, Test, and E2E (all `net10.0`) clean and confirmed the previously-failing completion test passes on 7.6.3. Drafted by Copilot (Claude Opus 4.8). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent b9c5001 commit 64d5caf

17 files changed

Lines changed: 43 additions & 55 deletions

File tree

‎.github/copilot-instructions.md‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@
22

33
## Build & Test
44

5-
Requires .NET SDK 8.0+. Use `dotnet` directly for building and testing — it's faster and
5+
Requires .NET SDK 10.0+. Use `dotnet` directly for building and testing — it's faster and
66
requires no extra tooling. The `Invoke-Build` script requires the `InvokeBuild` and `platyPS`
77
PowerShell modules (platyPS is `#Requires`'d at the top, so the whole script fails without it),
88
and is mainly needed to assemble the full PowerShell module for release.
99

1010
```powershell
1111
# Build (run both; Hosting depends on the core library)
1212
dotnet publish src/PowerShellEditorServices/PowerShellEditorServices.csproj -f netstandard2.0
13-
dotnet publish src/PowerShellEditorServices.Hosting/PowerShellEditorServices.Hosting.csproj -f net8.0
13+
dotnet publish src/PowerShellEditorServices.Hosting/PowerShellEditorServices.Hosting.csproj -f net10.0
1414
1515
# Run all unit tests
16-
dotnet test test/PowerShellEditorServices.Test/ --framework net8.0
16+
dotnet test test/PowerShellEditorServices.Test/ --framework net10.0
1717
1818
# Run a single test by name
19-
dotnet test test/PowerShellEditorServices.Test/ --framework net8.0 --filter "FullyQualifiedName~CompletesCommandInFile"
19+
dotnet test test/PowerShellEditorServices.Test/ --framework net10.0 --filter "FullyQualifiedName~CompletesCommandInFile"
2020
2121
# Run tests by trait category
22-
dotnet test test/PowerShellEditorServices.Test/ --framework net8.0 --filter "Category=Completions"
22+
dotnet test test/PowerShellEditorServices.Test/ --framework net10.0 --filter "Category=Completions"
2323
2424
# Run E2E tests
25-
dotnet test test/PowerShellEditorServices.Test.E2E/ --framework net8.0
25+
dotnet test test/PowerShellEditorServices.Test.E2E/ --framework net10.0
2626
```
2727

2828
For assembling the full module or running the complete CI suite (including Windows PowerShell
@@ -48,11 +48,11 @@ Protocol (DAP)** server for PowerShell, consumed by VS Code and other editors.
4848
- **`src/PowerShellEditorServices`** (`netstandard2.0`) — Core library containing all LSP/DAP
4949
handlers, services, and the PowerShell execution engine. Namespace:
5050
`Microsoft.PowerShell.EditorServices`.
51-
- **`src/PowerShellEditorServices.Hosting`** (`net8.0`, `net462`) — Entry point layer that loads
51+
- **`src/PowerShellEditorServices.Hosting`** (`net10.0`, `net462`) — Entry point layer that loads
5252
PSES into a PowerShell process via `StartEditorServicesCommand`. Uses a custom
5353
`AssemblyLoadContext` (`PsesLoadContext`) on .NET Core to isolate dependencies.
5454
- **`module/PowerShellEditorServices/`** — The shipped PowerShell module. The build assembles
55-
compiled binaries into `bin/Core/` (net8.0) and `bin/Desktop/` (net462). The module manifest
55+
compiled binaries into `bin/Core/` (net10.0) and `bin/Desktop/` (net462). The module manifest
5656
loads the appropriate DLL based on PowerShell edition.
5757

5858
### Key Services (registered in `PsesServiceCollectionExtensions`)
@@ -136,7 +136,7 @@ Because of that, treat any change to an existing `public` member as potentially
136136
### Multi-targeting
137137

138138
The core library targets `netstandard2.0` for compatibility with both .NET Core and .NET
139-
Framework. The hosting project and tests dual-target `net8.0` and `net462` (Windows PowerShell
139+
Framework. The hosting project and tests dual-target `net10.0` and `net462` (Windows PowerShell
140140
5.1). Non-Windows platforms skip `net462` targets.
141141

142142
## Pull Request Labels

‎Directory.Packages.props‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<PackageVersion Include="Microsoft.Extensions.Logging.Debug" Version="10.0.5" />
77
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.4.0" />
88
<PackageVersion Include="Microsoft.PowerShell.5.ReferenceAssemblies" Version="1.1.0" />
9-
<PackageVersion Include="Microsoft.PowerShell.SDK" Version="7.4.14" />
9+
<PackageVersion Include="Microsoft.PowerShell.SDK" Version="7.6.3" />
1010
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
1111
<PackageVersion Include="OmniSharp.Extensions.DebugAdapter.Client" Version="0.19.9" />
1212
<PackageVersion Include="OmniSharp.Extensions.DebugAdapter.Server" Version="0.19.9" />

‎PowerShellEditorServices.build.ps1‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ $script:BuildInfoPath = "src/PowerShellEditorServices.Hosting/BuildInfo.cs"
4040

4141
$script:NetFramework = @{
4242
PS51 = 'net462'
43-
PS74 = 'net8.0'
43+
PS74 = 'net10.0'
4444
Standard = 'netstandard2.0'
4545
}
4646

@@ -58,7 +58,7 @@ Task FindDotNet {
5858

5959
# Strip out semantic version metadata so it can be cast to `Version`
6060
[Version]$existingVersion, $null = (dotnet --version) -split " " -split "-"
61-
Assert ($existingVersion -ge [Version]("8.0")) ".NET SDK 8.0 or higher is required, please update it: https://aka.ms/dotnet-cli"
61+
Assert ($existingVersion -ge [Version]("10.0")) ".NET SDK 10.0 or higher is required, please update it: https://aka.ms/dotnet-cli"
6262

6363
Write-Build DarkGreen "Using dotnet v$(dotnet --version) at path $((Get-Command dotnet).Source)"
6464
}

‎global.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "8.0.416",
3+
"version": "10.0.301",
44
"rollForward": "latestFeature",
55
"allowPrerelease": false
66
}

‎src/PowerShellEditorServices.Hosting/PowerShellEditorServices.Hosting.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), PowerShellEditorServices.Common.props))\PowerShellEditorServices.Common.props" />
44

55
<PropertyGroup>
6-
<TargetFrameworks>net8.0;net462</TargetFrameworks>
6+
<TargetFrameworks>net10.0;net462</TargetFrameworks>
77
<AssemblyName>Microsoft.PowerShell.EditorServices.Hosting</AssemblyName>
88
</PropertyGroup>
99

‎src/PowerShellEditorServices/Services/CodeLens/ReferencesCodeLensProvider.cs‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ internal class ReferencesCodeLensProvider : ICodeLensProvider
2525
/// </summary>
2626
private readonly IDocumentSymbolProvider _symbolProvider;
2727
private readonly SymbolsService _symbolsService;
28-
private readonly WorkspaceService _workspaceService;
2928

3029
public static string Id => nameof(ReferencesCodeLensProvider);
3130

@@ -38,11 +37,9 @@ internal class ReferencesCodeLensProvider : ICodeLensProvider
3837
/// <summary>
3938
/// Construct a new ReferencesCodeLensProvider for a given EditorSession.
4039
/// </summary>
41-
/// <param name="workspaceService"></param>
4240
/// <param name="symbolsService"></param>
43-
public ReferencesCodeLensProvider(WorkspaceService workspaceService, SymbolsService symbolsService)
41+
public ReferencesCodeLensProvider(SymbolsService symbolsService)
4442
{
45-
_workspaceService = workspaceService;
4643
_symbolsService = symbolsService;
4744
// TODO: Pull this from components
4845
_symbolProvider = new ScriptDocumentSymbolProvider();

‎src/PowerShellEditorServices/Services/PowerShell/Debugging/IPowerShellDebugContext.cs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ internal interface IPowerShellDebugContext
1313

1414
DebuggerStopEventArgs LastStopEventArgs { get; }
1515

16-
public bool IsDebuggingRemoteRunspace { get; set; }
16+
bool IsDebuggingRemoteRunspace { get; set; }
1717

18-
public event Action<object, DebuggerStopEventArgs> DebuggerStopped;
18+
event Action<object, DebuggerStopEventArgs> DebuggerStopped;
1919

20-
public event Action<object, DebuggerResumingEventArgs> DebuggerResuming;
20+
event Action<object, DebuggerResumingEventArgs> DebuggerResuming;
2121

22-
public event Action<object, BreakpointUpdatedEventArgs> BreakpointUpdated;
22+
event Action<object, BreakpointUpdatedEventArgs> BreakpointUpdated;
2323

2424
void Continue();
2525

‎src/PowerShellEditorServices/Services/PowerShell/Debugging/PowerShellDebugContext.cs‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,7 @@ public void SetDebugResuming(DebuggerResumeAction debuggerResumeAction)
114114
// then this came over LSP and we need to set it.
115115
_psesHost.SetExit();
116116

117-
if (LastStopEventArgs is not null)
118-
{
119-
LastStopEventArgs.ResumeAction = debuggerResumeAction;
120-
}
117+
LastStopEventArgs?.ResumeAction = debuggerResumeAction;
121118

122119
// We need to tell whatever is happening right now in the debug prompt to wrap up so we
123120
// can continue. However, if the host was initialized with the console REPL disabled,

‎src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousTask.cs‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ internal abstract class SynchronousTask<TResult> : ISynchronousTask
2525
private readonly CancellationToken _taskRequesterCancellationToken;
2626

2727
private bool _executionCanceled;
28-
29-
private TResult _result;
30-
3128
private ExceptionDispatchInfo _exceptionInfo;
3229

3330
protected SynchronousTask(
@@ -57,8 +54,10 @@ public TResult Result
5754

5855
_exceptionInfo?.Throw();
5956

60-
return _result;
57+
return field;
6158
}
59+
60+
private set;
6261
}
6362

6463
public bool IsCanceled => _executionCanceled || _taskRequesterCancellationToken.IsCancellationRequested;
@@ -123,7 +122,7 @@ private void SetException(Exception e)
123122

124123
private void SetResult(TResult result)
125124
{
126-
_result = result;
125+
Result = result;
127126
_taskCompletionSource.SetResult(result);
128127
}
129128
}

‎src/PowerShellEditorServices/Services/Symbols/ReferenceTable.cs‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ internal sealed class ReferenceTable
2222

2323
private readonly ConcurrentDictionary<string, ConcurrentBag<SymbolReference>> _symbolReferences = new(StringComparer.OrdinalIgnoreCase);
2424

25-
private bool _isInited;
26-
2725
public ReferenceTable(ScriptFile parent) => _parent = parent;
2826

2927
/// <summary>
@@ -32,15 +30,15 @@ internal sealed class ReferenceTable
3230
public void TagAsChanged()
3331
{
3432
_symbolReferences.Clear();
35-
_isInited = false;
33+
IsInitialized = false;
3634
}
3735

3836
/// <summary>
39-
/// Prefer checking if the dictionary has contents to determine if initialized. The field
40-
/// `_isInited` is to guard against re-scanning files with no command references, but will
37+
/// Prefer checking if the dictionary has contents to determine if initialized. The backing
38+
/// field is to guard against re-scanning files with no command references, but will
4139
/// generally be less reliable of a check.
4240
/// </summary>
43-
private bool IsInitialized => !_symbolReferences.IsEmpty || _isInited;
41+
private bool IsInitialized { get => !_symbolReferences.IsEmpty || field; set; }
4442

4543
internal IEnumerable<SymbolReference> TryGetReferences(SymbolReference? symbol)
4644
{

0 commit comments

Comments
 (0)