You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the feature
People usually use not only one but several PowerShell modules, which often cause assembly conflicts depending on the order the modules were loaded or used.
Developers of a given module often "lives in a bubble" where everything inside the module works fine, but in real-life scenarios, where multiple modules from multiple providers are used, they might fall short due to assembly load design of the module.
Enter Assembly Load Contexts (ALCs). ALCs were introduced in .NET Core 1.0 to specifically address the need to load multiple versions of the same assembly into the same runtime.
ALC is the "new" way of loading assemblies in PowerShell 7, and should have better ways of handling multiple versions of the same assembly. There are a few samples in the code below that show how to avoid this breaking code into two modules and using the IModuleAssemblyInitializer to lazy load and undload assemblies into ALC.
How will this feature enhance your project and further the project’s overall goals? Who will benefit from this feature (i.e. all users; the project team)?
Try and do a search on Az, MgGraph, PnP.PowerShell github issues lists or other foras. One of the most common issues with PowerShell modules are assembly conflicts (our new "dll-hell") due to the fact that a module loads a dll when a certain function is used, and depending on module versions and order the involved PowerShell modules was loaded, errors will occur.
ALC bridging pattern makes it possible to load multiple versions of the same assembly, hence minimizing the assembly conflicts and resulting in a more robust module and less frustrated users :)
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered:
Acknowledged, @AndersRask. Thanks so much for the ACL recommendation! Our Engineering team will be looking into this as soon as possible. We’re excited to work towards interoperability that reflects real-world scenarios.
Describe the feature
People usually use not only one but several PowerShell modules, which often cause assembly conflicts depending on the order the modules were loaded or used.
Developers of a given module often "lives in a bubble" where everything inside the module works fine, but in real-life scenarios, where multiple modules from multiple providers are used, they might fall short due to assembly load design of the module.
Enter Assembly Load Contexts (ALCs). ALCs were introduced in .NET Core 1.0 to specifically address the need to load multiple versions of the same assembly into the same runtime.
ALC is the "new" way of loading assemblies in PowerShell 7, and should have better ways of handling multiple versions of the same assembly. There are a few samples in the code below that show how to avoid this breaking code into two modules and using the IModuleAssemblyInitializer to lazy load and undload assemblies into ALC.
https://learn.microsoft.com/en-us/powershell/scripting/dev-cross-plat/resolving-dependency-conflicts?view=powershell-7.3#more-robust-solutions
How will this feature enhance your project and further the project’s overall goals? Who will benefit from this feature (i.e. all users; the project team)?
Try and do a search on Az, MgGraph, PnP.PowerShell github issues lists or other foras. One of the most common issues with PowerShell modules are assembly conflicts (our new "dll-hell") due to the fact that a module loads a dll when a certain function is used, and depending on module versions and order the involved PowerShell modules was loaded, errors will occur.
ALC bridging pattern makes it possible to load multiple versions of the same assembly, hence minimizing the assembly conflicts and resulting in a more robust module and less frustrated users :)
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: