Skip to content

Commit 85e60dd

Browse files
committed
Disable shadow copying of assemblies in .NET 4.6.x
On Windows this seems to default to true, and it causes issues as the `Location` attribute of our assemblies intead points to the cached assembly. Unfortunately, we use this attribute to find e.g. the PSReadLine module. So we disable shadow copying of assemblies. This is not applicable to .NET Core.
1 parent 979988c commit 85e60dd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/PowerShellEditorServices.Hosting/EditorServicesLoader.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ public static EditorServicesLoader Create(
111111
// In .NET Framework we add an event here to redirect dependency loading in the current AppDomain for PSES' dependencies
112112
logger.Log(PsesLogLevel.Verbose, "Adding AssemblyResolve event handler for dependency loading");
113113

114+
// We also disable shadow copied assemblies so that the `Location` attribute is correct
115+
AppDomainSetup.ShadowCopyFiles = false;
116+
114117
if (hostConfig.LogLevel == PsesLogLevel.Diagnostic)
115118
{
116119
AppDomain.CurrentDomain.AssemblyLoad += (object sender, AssemblyLoadEventArgs args) =>

0 commit comments

Comments
 (0)