Skip to content

Honor BundledModulesPath when loading modules in PowerShellContextService #1516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
26818b3
Added BundledModulesPath to HostStartupInfo object and if it is valid…
dkattan Jun 28, 2021
2888045
Fixed s_bundledModulesPath assignment.
dkattan Jun 30, 2021
d0bc52d
Merge branch 'PowerShell:master' into honor-bundledmodulespath-parameter
dkattan Jul 6, 2021
e590fad
Fixed missing BundledModulesPath parameter assignment
dkattan Jul 6, 2021
52b16ca
Restored PowerShellEditorServices.Commands.psd1
dkattan Jul 6, 2021
d8738f0
removed #if TEST from PowerShellContextService.cs and instead provide…
dkattan Jul 6, 2021
ee154b0
removed #if TEST from PowerShellContextService.cs and instead provide…
dkattan Jul 6, 2021
b91382b
Merge branch 'honor-bundledmodulespath-parameter' of github.com:dkatt…
dkattan Jul 6, 2021
77186f0
Added logging to CanGetPSReadLineProxy test
dkattan Jul 6, 2021
48d1a96
Adjusted BundledModulesPath, re-enabled Windows test.
dkattan Jul 6, 2021
7037115
Added more logging to tests, implemented additional mechanism to find…
dkattan Jul 6, 2021
a0fa3c5
Implemented fix to find the non VSS cached location of the executing …
dkattan Jul 6, 2021
1443baa
Implemented fix to find the non VSS cached location of the executing …
dkattan Jul 6, 2021
bda11be
Attempted different fix for relative path to module directory.
dkattan Jul 6, 2021
bda40ea
Cleaned up logging
dkattan Jul 6, 2021
01957e6
Removed TEST property. Moved Set-ExecutionPolicy to before attempted …
dkattan Jul 7, 2021
9a045d9
Fixed formatting in PowerShellEditorServices.build.ps1
dkattan Jul 7, 2021
e1e70cf
Fixed issue where BundledModulePath was _not_ actually getting set.
dkattan Jul 7, 2021
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 @@ -160,6 +160,7 @@ public async Task CanGetPSReadLineProxy()
"..",
"module"
);
System.Console.WriteLine($"Attempting to import {s_bundledModulesPath}");
Copy link
Member

Choose a reason for hiding this comment

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

Just FYI I am debugging this test on Windows right now, really want to know why it worked everywhere but there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hah, me too. I think this last change fixed it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this PR should be the first to go in. It made sense to bring in the Changes from #1520 so I'll close that PR as this handles both issues.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah maybe not, PowerShell 7 | Windows 10 has already failed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

macOS:
executingAssembly /Users/runner/work/1/s/test/PowerShellEditorServices.Test/bin/Debug/netcoreapp3.1/Microsoft.PowerShell.EditorServices.Test.dll

Windows: executingAssembly C:\Users\VssAdministrator\AppData\Local\Temp\b5b3251f-c622-45f2-bc10-c8a646797337\b5b3251f-c622-45f2-bc10-c8a646797337\assembly\dl3\e3727c32\64017e66_b772d701\Microsoft.PowerShell.EditorServices.Test.dll

https://stackoverflow.com/questions/8309411/what-is-cache-appdata-local-assembly-dl3

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Evidently we shouldn't be using GetExecutingAssembly().Location as this can return a Volume Shadow Copy cached version of the DLL. We're using it in 9 other places...

Code File Line
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); test\PowerShellEditorServices.Test.E2E\DebugAdapterProtocolMessageTests.cs 26
: Path.GetDirectoryName(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); src\PowerShellEditorServices.Hosting\Commands\StartEditorServicesCommand.cs 302
Assembly.GetExecutingAssembly().Location, src\PowerShellEditorServices.Hosting\Commands\StartEditorServicesCommand.cs 344
private static readonly string s_psesBaseDirPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); src\PowerShellEditorServices.Hosting\EditorServicesLoader.cs 34
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), src\PowerShellEditorServices.Hosting\EditorServicesLoader.cs 39
private static string s_bundledModulesPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "..", ".."); src\PowerShellEditorServices\Services\PowerShellContext\PowerShellContextService.cs 35
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); test\PowerShellEditorServices.Test.E2E\LanguageServerProtocolMessageTests.cs 36
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); test\PowerShellEditorServices.Test.E2E\LSPTestsFixures.cs 31
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); test\PowerShellEditorServices.Test.E2E\Processes\PsesStdioProcess.cs 19

Assert.True(PSReadLinePromptContext.TryGetPSReadLineProxy(
NullLogger.Instance,
PowerShellContextFactory.initialRunspace,
Expand Down