Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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
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
Copy Markdown
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 1 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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.