Skip to content

Remove redundant check from Start-EditorServices#2333

Open
ChrisTX wants to merge 1 commit into
PowerShell:mainfrom
ChrisTX:fixstartuploglevel
Open

Remove redundant check from Start-EditorServices#2333
ChrisTX wants to merge 1 commit into
PowerShell:mainfrom
ChrisTX:fixstartuploglevel

Conversation

@ChrisTX

@ChrisTX ChrisTX commented Jun 26, 2026

Copy link
Copy Markdown

6f76c6e introduced a correct change to the ValidateSet, but added a redundant check that is already handled in StartEditorServicesCommand.cs in its StartLogging() routine. In fact, exchanging the values in Start-EditorServices will suppress the warning about the old PSES log levels that StartLogging() would normally emit.

However, the check is actually harmful on top of this issue since it doesn't check if LogLevel is even set.
If LogLevel is $null, then the default option

default { $LogLevel }

isn't valid PowerShell anymore:

The variable cannot be validated because the value $null is not a valid value for the LogLevel variable.

6f76c6e introduced a correct change to
the ValidateSet, but added a redundant check that is already handled in
`StartEditorServicesCommand.cs` in its `StartLogging()` routine. In
fact, exchanging the values in Start-EditorServices will suppress the
warning about the old PSES log levels that `StartLogging()` would
normally emit.

However, the check is actually harmful on top of this issue since it
doesn't check if LogLevel is even set.
If LogLevel is `$null`, then the default option
```
default { $LogLevel }
```
isn't valid PowerShell anymore:
```
The variable cannot be validated because the value $null is not a valid value for the LogLevel variable.
```
Copilot AI review requested due to automatic review settings June 26, 2026 22:50
@ChrisTX ChrisTX requested a review from a team as a code owner June 26, 2026 22:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes a redundant log-level translation block from Start-EditorServices.ps1. The translation of legacy PSES log levels (Diagnostic, Verbose, Normal) to Microsoft.Extensions.Logging (MEL) levels is already handled in the StartLogging() routine of StartEditorServicesCommand.cs. The script-side block was not only redundant but harmful: it suppressed the deprecation warning emitted by the C# code, and its default { $LogLevel } branch would throw a ValidateSet error when $LogLevel was $null.

Changes:

  • Removed the legacy-to-MEL log level translation switch block from the script.
  • Normalized indentation (tabs → spaces) on the $SessionDetailsPath parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants