PowerShell Interactive Window doesn't initialize to solution directory

I have several projects that for some reason PowerShell Interactive Window doesn’t initialize in the solution directory. This happens to me in both Visual Studio 2017 and 2019 with version 2022.3.0 (though it also occurred with previous versions). This does not happen for all my projects, only some of them. This also seems to occur when creating brand new projects from scratch in both versions of Visual Studio as well. Finally, I just noticed today that this only seems to happen if the PowerShell Interactive Window is opened prior to opening the project, that is if I close the PowerShell Interactive Window and then close and re-open the project in Visual Studio and then open the PowerShell Interactive Window (from View → PowerShell → PowerShell Interactive Window) it initializes to the solution directory as expected.

This sounds like a bug. Could be some weird timing issue or something where it doesn’t always set the proper directory. I’ll open an issue for it.

Thank you. Up until I created the question on Friday I didn’t know that opening the interactive window after the project was opened worked. My window is always open from my previous session.

Good to know. That will help narrow down a fix for this. Thanks for following up!