question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Azure Functions: Assembly with same name is already loaded System.Management.Automation.dll

See original GitHub issue

Steps 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:open
  • Created 3 years ago
  • Comments:13

github_iconTop GitHub Comments

2reactions
MortenReicommented, Aug 14, 2021

Any news to this issue? Anyone been able to find a combination that actually works?

1reaction
slavizhcommented, Nov 13, 2020

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found