-
Notifications
You must be signed in to change notification settings - Fork 241
Closed
Labels
Area-Script AnalysisIssue-BugA bug to squash.A bug to squash.Resolution-AnsweredWill close automatically.Will close automatically.
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest version
- Search the existing issues.
Steps to reproduce
trying to import PSScriptAnalyser when using the Integrated Terminal fails as the powershell extension has already loaded the PSScriptAnalyzer assemblies. However the PSScriptAnalyzer module isn't loaded
This means you can't then use PSScriptAnalyzer commands
Expected behavior
Import-module PSScriptAnalyzer worksActual behavior
import-module PSScriptAnalyzer
Import-Module: Assembly with same name is already loaded
### Error details
```console
Type : System.Management.Automation.ActionPreferenceStopException
ErrorRecord :
Exception :
Type : System.IO.FileLoadException
Message : Assembly with same name is already loaded
TargetSite :
Name : LoadBinaryModule
DeclaringType : Microsoft.PowerShell.Commands.ModuleCmdletBase
MemberType : Method
Module : System.Management.Automation.dll
Source : System.Management.Automation
HResult : -2146232799
StackTrace :
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadBinaryModule(PSModuleInfo parentModule, String moduleName, String fileName, Assembly assemblyToLoad, String moduleBase, SessionState ss, ImportModuleOptions options,
ManifestProcessingFlags manifestProcessingFlags, String prefix, Boolean loadTypes, Boolean loadFormats, Boolean& found, String shortModuleName, Boolean disableFormatUpdates)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModule(PSModuleInfo parentModule, String fileName, String moduleBase, String prefix, SessionState ss, Object privateData, ImportModuleOptions& options, ManifestProcessingFlags
manifestProcessingFlags, Boolean& found, Boolean& moduleFileFound)
at Microsoft.PowerShell.Commands.ImportModuleCommand.ImportModule_LocallyViaName(ImportModuleOptions importModuleOptions, String name)
at Microsoft.PowerShell.Commands.ImportModuleCommand.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
CategoryInfo : NotSpecified: (:) [Import-Module], FileLoadException
FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell.Commands.ImportModuleCommand
InvocationInfo :
MyCommand : Import-Module
ScriptLineNumber : 34
OffsetInLine : 17
HistoryId : 4
ScriptName : C:\Users\SimonSabin\Documents\PowerShell\Modules\PSScriptAnalyzer\1.20.0\PSScriptAnalyzer.psm1
Line : $binaryModule = Import-Module -Name $binaryModulePath -PassThru
PositionMessage : At C:\Users\SimonSabin\Documents\PowerShell\Modules\PSScriptAnalyzer\1.20.0\PSScriptAnalyzer.psm1:34 char:17
+ $binaryModule = Import-Module -Name $binaryModulePath -PassThru
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PSScriptRoot : C:\Users\SimonSabin\Documents\PowerShell\Modules\PSScriptAnalyzer\1.20.0
PSCommandPath : C:\Users\SimonSabin\Documents\PowerShell\Modules\PSScriptAnalyzer\1.20.0\PSScriptAnalyzer.psm1
InvocationName : Import-Module
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, C:\Users\SimonSabin\Documents\PowerShell\Modules\PSScriptAnalyzer\1.20.0\PSScriptAnalyzer.psm1: line 34
at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :
TargetSite :
Name : Invoke
DeclaringType : System.Management.Automation.Runspaces.PipelineBase, System.Management.Automation, Version=7.2.7.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35
MemberType : Method
Module : System.Management.Automation.dll
Message : The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Assembly with same name is already loaded
Data : System.Collections.ListDictionaryInternal
Source : System.Management.Automation
HResult : -2146233087
StackTrace :
at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
at System.Management.Automation.PowerShell.Invoke[T](IEnumerable input, PSInvocationSettings settings)
at Microsoft.PowerShell.EditorServices.Services.PowerShell.Utility.PowerShellExtensions.InvokeAndClear[TResult](PowerShell pwsh, PSInvocationSettings invocationSettings) in
D:\a\_work\1\s\src\PowerShellEditorServices\Services\PowerShell\Utility\PowerShellExtensions.cs:line 76
at Microsoft.PowerShell.EditorServices.Services.PowerShell.Utility.PowerShellExtensions.InvokeCommand[TResult](PowerShell pwsh, PSCommand psCommand, PSInvocationSettings invocationSettings) in
D:\a\_work\1\s\src\PowerShellEditorServices\Services\PowerShell\Utility\PowerShellExtensions.cs:line 99
at Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution.SynchronousPowerShellTask`1.ExecuteNormally(CancellationToken cancellationToken) in
D:\a\_work\1\s\src\PowerShellEditorServices\Services\PowerShell\Execution\SynchronousPowerShellTask.cs:line 125
Environment data
Name Value
---- -----
PSVersion 7.2.7
PSEdition Core
GitCommitId 7.2.7
OS Microsoft Windows 10.0.22000
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Version
ms-vscode.powershell-2022.10.0
Visuals
No response
Metadata
Metadata
Assignees
Labels
Area-Script AnalysisIssue-BugA bug to squash.A bug to squash.Resolution-AnsweredWill close automatically.Will close automatically.