Azure Functions: Assembly with same name is already loaded System.Management.Automation.dll
See original GitHub issueSteps to reproduce
Importing the module version 3.0.10 fails with errors.
ERROR: Assembly with same name is already loaded
Exception :
Type : System.IO.FileLoadException
Message : Assembly with same name is already loaded
TargetSite :
Name : Bind_LoadAssemblies
DeclaringType : initialsessionstate
MemberType : Method
Module : System.Management.Automation.dll
StackTrace :
at System.Management.Automation.Runspaces.InitialSessionState.Bind_LoadAssemblies(ExecutionContext context)
at System.Management.Automation.Runspaces.InitialSessionState.Bind(ExecutionContext context, Boolean updateOnly, PSModuleInfo module, Boolean noClobber, Boolean local, Boolean setLocation)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleManifest(String moduleManifestPath, ExternalScriptInfo manifestScriptInfo, Hashtable data, Hashtable localizedData, ManifestProcessingFlags manifestProcessingFlags, Version minimumVersion, Version maximumVersion, Version requiredVersion, Nullable`1 requiredModuleGuid, ImportModuleOptions& options, Boolean& containedErrors)
Source : System.Management.Automation
HResult : -2146232799
CategoryInfo : InvalidOperation: (:) [Import-Module], FileLoadException
FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand
InvocationInfo :
MyCommand : Import-Module
ScriptLineNumber : 68
OffsetInLine : 1
HistoryId : 1
ScriptName : D:\home\site\wwwroot\profile.ps1
Line : Import-Module PartnerCenter 4>$null
PositionMessage : At D:\home\site\wwwroot\profile.ps1:68 char:1
+ Import-Module PartnerCenter 4>$null
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PSScriptRoot : D:\home\site\wwwroot
PSCommandPath : D:\home\site\wwwroot\profile.ps1
InvocationName : Import-Module
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, D:\home\site\wwwroot\profile.ps1: line 68
Expected behavior
Module should load.
Actual behavior
Module fails with reported error. It started happening on the 28th of October.
Diagnostic logs
Environment
I did not change anything when the issue started appearing. Azure functions runtime version 3 PS 7.0
requirements.psd1
@{
'Az' = '4.7'
'PartnerCenter' = '3.*'
}
I have tried using Az 5.0 as well but this did not change anything. I am not sure if it is related to Az Powershell changes, as I did not see anything too specific about this. I could be wrong.
profile.ps1 imports module AzTable before importing Partner Center.
I will update if I find anything that could be used.
Issue Analytics
- State:
- Created 3 years ago
- Comments:13
Top Results From Across the Web
Azure Automation PowerShell Error "Assembly with same ...
The error message "Assembly with same name is already loaded" occurs when you try to import a module in Azure Automation that has...
Read more >Error of Assembly with same name is already loaded doing ...
In an Azure Function I am trying to load a PowerShell module but getting the error Assembly with same name is already loaded....
Read more >Azure Function App fails with: “ERROR: Assembly with ...
Azure Function App fails with: “ERROR: Assembly with same name is already loaded”. I was recently notified by a colleague that the Azure ......
Read more >Resolving PowerShell Module Conflicts | How
Azure.Management.Storage.dll C:\Program ... Management.Automation ┗ Class1.cs ... Import-Module: Assembly with same name is already loaded.
Read more >Azure connector - Could not load file or assembly ...
Hi there, I'm currently facing the following issue after I implemented the Azure Connector based on the documentation.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Any news to this issue? Anyone been able to find a combination that actually works?
The PowerShell Az team reported that the problems I have - the one specific to PS 7.1 and other that is not specific to PS version should be fixed by the Partner Center module team. Statement is located here: https://github.com/Azure/azure-powershell/issues/13423