-
Notifications
You must be signed in to change notification settings - Fork 499
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
Microsoft.Extensions.Logging.Abstractions Error in vscode only. #4475
Comments
It looks like |
I'm actually not able to repro this. I installed the
It sure looks like |
Yup, I verified that both ours and theirs is loaded without issue:
|
@justcain-ok can you give me more details? Can you verify that you actually have all of Mdbc's dependencies installed? I think you really are just missing |
@andschwa , so that got me in the right direction, this is weird. When I checked assemblies I got this output: Microsoft.Extensions.Logging.Abstractions, Version=7.0.0.0, Culture=neutral, So, just get why. Can it because is synced settings to vscode? |
I have a suspicion...do you have any other modules imported that may be requiring So, what's the path of |
GAC Version Location False v4.0.30319 /Users/x/.local/share/powershell/Modules/Az.IotHub/2.7.5/Microsoft.Extensions.Logging.Abstractions.dll But that module is loaded in "terminal" as well. |
@andschwa Well its solved now, if you ever meet me tap my shoulder and you can have a beer, or what ever is to your liking, thank you so much! |
Sure looks to me like the Azure module developers implemented an AssemblyLoadContext for their I browsed through the Az.IotHub module's sources in that same repo and it sure enough depends on a conflicting version of |
Interestingly they have an @justcain-ok I'll be at PSConfEU this year if you happen to be there! |
Did you find any solution? I have a similar problem with the |
@htcfreek the latest preview isolates a lot of dependencies including logging into an ALC, so it should prevent conflicts in this regard with vscode/PSES itself, however we cannot prevent conflicts between modules, but there should be a lot less that only conflicts in vscode but doesn't conflict in PowerShell Also note that the intellisense and scriptanalyzer will opportunistically load modules to do analysis so it may seem to only happen in vscode when in reality it would happen if you loaded these modules in that order in a normal pwsh as well, you may need to disable those or load them in your profile if they are required in a specific order (you must load higher versioned dependencies above lower versioned ones to avoid a conflict, and even then it's not guaranteed if there was a breaking change such as the removal of a method that was depended upon) And, as usual, 5.1 doesn't follow any of these rules and is best effort so we recommend you use 7+ to author scripts (those scripts can still be 5.1 compatible) |
Prerequisites
Summary
I get an error when I use a PowerShell to leverage packages that have a dependency on Microsoft.Exentions.Logging.Abstractions.
.NET SDK:
Version: 7.0.202
Commit: 6c74320bc3
Runtime Environment:
OS Name: Mac OS X
OS Version: 13.2
OS Platform: Darwin
RID: osx.13-arm64
Base Path: /usr/local/share/dotnet/sdk/7.0.202/
Host:
Version: 7.0.4
Architecture: arm64
Commit: 0a396acafe
.NET SDKs installed:
6.0.407 [/usr/local/share/dotnet/sdk]
7.0.202 [/usr/local/share/dotnet/sdk]
Microsoft.Extensions.Logging.Abstractions have no dependencies themselves when using net6.0 or net7.0. This works perfectly fine in the terminal on the same device, but throws an error in vs code with the PowerShell extension:
Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9743819ddae60'. Could not find or load a specific file. (0x80131621)
PowerShell Version
Visual Studio Code Version
Extension Version
[email protected]
Steps to Reproduce
The fastest way to reproduce it is to download https://github.com/nightroman/Mdbc and import and run Connect-Mdbc.
Or download MongoDB.Driver 2.19.0 and try to connect to a db:
add-type -Path .MongoDB.Driver.dll
$mongo=new-object mongodb.driver.mongo
etc
Visuals
Logs
No response
The text was updated successfully, but these errors were encountered: