From 98303ea6e7f8d24e00f69018298353ba1cfc0671 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Mon, 25 Apr 2016 16:56:26 -0700 Subject: [PATCH] Avoid trying to load DLLs as Snap-Ins with Import-Module Thanks @lzybkr. --- .../engine/Modules/ModuleCmdletBase.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs b/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs index ddac1ac975..d8beb019a6 100644 --- a/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs +++ b/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs @@ -6827,7 +6827,6 @@ namespace Microsoft.PowerShell.Commands InitialSessionState iss = InitialSessionState.Create(); List detectedCmdlets = null; List> detectedAliases = null; - PSSnapInException warning; Assembly assembly = null; Exception error = null; bool importSuccessful = false; @@ -6885,6 +6884,9 @@ namespace Microsoft.PowerShell.Commands { PSSnapInInfo snapin = null; +#if !CORECLR + // Avoid trying to load SnapIns with Import-Module + PSSnapInException warning; try { if (importingModule) @@ -6897,6 +6899,7 @@ namespace Microsoft.PowerShell.Commands //BUGBUG - brucepay - probably want to have a verbose message here... ; } +#endif if (snapin != null) {