Description
Is your feature request related to a problem? Please describe the problem.
According to vscode-powershell
maintainers, Azure PowerShell (and I assume Microsoft.Graph
too as I see similar problems with it) does not "implement assembly isolation correctly across the board".
This can cause assembly conflict issues that vscode-powershell
can't solve easily from their context.
I don't have deep knowledge about this, I just want my authoring experience where Microsoft owns every part of the stack fixed.
Here are some resources on how, using assembly load context (ALC):
- https://www.youtube.com/watch?v=__J7b84BAmQ
- https://pipe.how/get-assemblyloadcontext
- https://github.com/daxian-dbw/PowerShell-ALC-Samples
- https://learn.microsoft.com/en-us/powershell/scripting/dev-cross-plat/resolving-dependency-conflicts
- https://learn.microsoft.com/en-us/dotnet/api/system.runtime.loader.assemblyloadcontext?view=net-8.0
Here is more context:
- 2020-10-15: Conflict with the .Net dll of the Az module PowerShell/vscode-powershell#3012
- 2023-09-05: Unable to load Az modules - Assembly with same name is already loaded PowerShell/vscode-powershell#4727
- 2024-09-30:
vscode-powershell
messes upMicrosoft.Graph.Authentication
PowerShell/vscode-powershell#5053
Here are other related issues:
- 2023-07-11: Assembly conflict between Az.Account and Microsoft.Graph.Authentication in PowerShell 5.1 #2148
- 2023-07-31: Az.Accounts & Microsoft.Graph.Authentication using different versions of Azure.Core.dll Azure/azure-powershell#22449
- 2023-11-07: Getting server timed out error running export command microsoft/Microsoft365DSC#3867
- 2023-11-09: Microsoft.Graph.authentication: Could not load file or assembly #2424
- 2024-02-13: When recent Az.* modules are loaded, Connect-MgGraph errors out #2587
Describe the solution you'd like.
Find out if anything can be done here to make Microsoft.Graph modules play nice with vscode-powershell
.
Edit: Use AssemblyLoadContext for all assembly dependencies loaded by any Microsoft.Graph module.
Additional context?
No response