-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WinRT.Runtime conflict in PowerShell 7.3.8 #3819
Comments
As I was writing this issue, I came up with a culprit. The BurnToast module uses the same assembly. If I load this module after the Winget module, I get an error: Write-Error: Failed to load library C:\Program Files\WindowsPowerShell\Modules\burnttoast\0.8.5\lib\Microsoft.Windows.SDK.NET\WinRT.Runtime.dll: Assembly with same name is already loaded If I load the BurnToast module first, I can load the Winget module without error. I only get the error when I try to run a command. The import process should throw the same type of exception that the BurntToast module does. |
It looks like the BurnToast module and Winget module use the same version of WinRT.Runtime. |
Is this happening in Windows PowerShell or in PowerShell 7? We have some missing assemblies to hunt down to get everything working correctly in Windows PowerShell. |
I'm using PowerShell 7 for this. |
Which version of BurnToast are you using? This won't work with the latest non prerelease version (0.8.5), but will do for 1.0.0 Pre release version
Release version
For more context, the winget modules uses their own custom AssemblyLoadContext to load binaries there with the goal to avoid these kinds of conflicts, but sadly WinRT.Runtime.dll can't be loaded in a custom ALC. See more info in #3253. Because of that we explicitly load it in the default context. |
I'm still using |
I created an issue in CsWinRT microsoft/CsWinRT#1371 |
Brief description of your issue
I am running version 0.2.2 of the Microsoft.Winget.Client module, although I had this problem in the earlier version. In a PowerShell 7 session running with no profile, I can import and use the module with no problem. In my normal session, with a profile, I can import the module with no errors. But when I run any command, I get the error
The type initializer for '<Module>' threw an exception.
I've narrowed down at least part of the problem to the fact that not all DLLs are getting loaded. I think the
WinRT.Runtime
is the culprit. I tried manually adding it in my PowerShell session and it fails.Environment
The text was updated successfully, but these errors were encountered: