Close

Argument Trace: HostName

A project log for Source Code Analysis: PowerShellEditorServices

Source Code Breakdown of PowerShellEditorServices (at the time of v3.5.4)

nicholas-jacksonNicholas Jackson • 10/22/2022 at 00:49•9 Comments

Start-EditorServices.cs:

HostName:

hostInfo:

CreateConfigObject():

EditorServicesLoader psesLoader:

EditorServicesLoader.Create():

psesLoader.LoadAndRunEditorServicesAsync(): - NOTE: psesLoader should call on an EditorServicesRunner object


In order to further understand how PSES processes hostname, we need to dig into languageServer

Discussions

Nicholas Jackson wrote 10/30/2022 at 03:59 • point

psesinternalhost also gets wrapped by EditorOperationsService

  Are you sure? yes | no

Nicholas Jackson wrote 10/30/2022 at 03:57 • point

an alias for psesinternalhost is IInternalPowerShellExecutionService executionService

  Are you sure? yes | no

Nicholas Jackson wrote 10/30/2022 at 03:47 • point

RunspaceFactory is an SMA class! Which means we finally found what it hostname is used for lol

  Are you sure? yes | no

Nicholas Jackson wrote 10/30/2022 at 03:44 • point

gets passed:

Runspace runspace = RunspaceFactory.CreateRunspace(PublicHost, initialSessionState);

  Are you sure? yes | no

Nicholas Jackson wrote 10/30/2022 at 03:42 • point

EditorServicesConsolePSHost also uses hostname as EditorServicesConsolePSHost.name (which is grabbed from PsesInternalHost.name)

  Are you sure? yes | no

Nicholas Jackson wrote 10/30/2022 at 03:22 • point

gets passed to CreateInitialPowerShell, but it doesn't use hostinfo.name

  Are you sure? yes | no

Nicholas Jackson wrote 10/30/2022 at 03:21 • point

also gets refactored into PsesInternalHost

as PsesInternalHost.hostinfo and PsesInternalHost.name (hostinfo.name)

  Are you sure? yes | no

Nicholas Jackson wrote 10/30/2022 at 03:20 • point

HostStartupInfo:

Gets passed to omnisharp as part of PsesLanguageServer creation

AddPsesLanguageServices() can be used to do this

  Are you sure? yes | no

Nicholas Jackson wrote 10/30/2022 at 03:14 • point

EditorServicesConfig:
Passed to:

<EditorServicesLoader>psesLoader.<EditorServicesRunner>_editorServicesRunner.<EditorServicesConfig>config.<HostInfo>HostInfo.name

<EditorServicesLoader>psesLoader.<EditorServicesConfig>_hostConfig.<HostInfo>HostInfo.name

<EditorServicesRunner>

Dumped by:

EditorServicesLoader.LogHostInformation()

Injected by:

EditorServicesLoader.LoadAndRunEditorServicesAsync() to EditorServicesRunner

  Are you sure? yes | no