PowerShellEditorServices
PowerShellEditorServices copied to clipboard
Investigate using LanguagePrimitives.ConvertTo rather than the converter attribute
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...