PowerShell / PowerShell/PowerShellEditorServices

Investigate using LanguagePrimitives.ConvertTo rather than the converter attribute

Open
#1,579 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Debugging Issue-Enhancement
Dominant language
C#
Stars
767
Forks
266
Avg merge
3d 16h
Merged PRs (30d)
1

Description

In the debugger code we currently go to great lengths to find and execute a type conversion attribute on variables:

https://github.com/PowerShell/PowerShellEditorServices/blob/f9bde73000a6e2a8ebfc721d675dcb1c60316092/src/PowerShellEditorServices/Services/DebugAdapter/DebugService.cs#L489-L522

Most of this can't be avoided, but one thing we do here is use the EngineIntrinsics value to execute the conversion attribute on the pipeline thread, which means we need to contend for and wait on a pipeline thread execution.

Instead of this, we could maybe call LanguagePrimitives.ConvertTo() with the known target type and ideally not need to use the pipeline thread.

This might not be possible, but is worth investigating...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the conversion handling in src/PowerShellEditorServices/Services/DebugAdapter/DebugService.cs at lines 489-522, especially the EngineIntrinsics and pipeline-thread use. Compare that path with LanguagePrimitives.ConvertTo() for the known target type. Done means establishing whether the conversion can avoid pipeline-thread execution and documenting or implementing the viable approach.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
devtools
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.