Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1612,6 +1612,7 @@ private void DoCreateRunspace(string initialCommand, bool skipProfiles, bool sta
OpenConsoleRunspace(consoleRunspace, staMode);
}

Runspace.PrimaryRunspace = consoleRunspace;
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like PrimaryRunspace gets set again within OpenConsoleRunspace if it fails to open the first time. But I agree it makes more sense to set it here.

_runspaceRef = new RunspaceRef(consoleRunspace);

if (psReadlineFailed)
Expand Down Expand Up @@ -1656,10 +1657,8 @@ private void OpenConsoleRunspace(Runspace runspace, bool staMode)
#endif
runspace.ThreadOptions = PSThreadOptions.ReuseThread;
runspace.EngineActivityId = EtwActivity.GetActivityId();
Runspace.PrimaryRunspace = runspace;

s_runspaceInitTracer.WriteLine("Calling Runspace.Open");

runspace.Open();
}

Expand Down
1 change: 1 addition & 0 deletions src/powershell-win-core/powershell-win-core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<Compile Include="..\powershell\Program.cs" Exclude="bin\**;obj\**;**\*.xproj;packages\**" />
<Content Include="..\System.Management.Automation\powershell.config.json">
<Link>powershell.config.json</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Include="..\Modules\Windows-Core\**\*;..\Modules\Windows-Core+Full\**\*;..\Modules\Shared\**\*">
Expand Down