Skip to content
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

vscode-powershell messes up Microsoft.Graph.Authentication #5053

Closed
6 tasks done
o-l-a-v opened this issue Sep 30, 2024 · 4 comments
Closed
6 tasks done

vscode-powershell messes up Microsoft.Graph.Authentication #5053

o-l-a-v opened this issue Sep 30, 2024 · 4 comments
Labels
Issue-Bug A bug to squash. Needs: Triage Maintainer attention needed!

Comments

@o-l-a-v
Copy link
Contributor

o-l-a-v commented Sep 30, 2024

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.

Summary


  • Windows 11 23H2 22631.4169 x64
  • PowerShell v7.4.5
  • VSCode v1.93.1 x64
  • vscode-powershell v2024.2.2
  • Microsoft.Graph.Authentication v2.23.0

Related issue:


I can't get the following to work from a vscode-powershell terminal, but it works in a barebone PowerShell v7.4.5 terminal, and the same PowerShell version through Windows Terminal.

Connect-MgGraph -ContextScope 'Process' -NoWelcome -UseDeviceCode -Scopes (
    'PrivilegedAccess.Read.AzureADGroup',
    'PrivilegedEligibilitySchedule.Read.AzureADGroup'
)

In VSCode this throws:

Connect-MgGraph: Method not found: 'System.Threading.Tasks.Task`1<Azure.Identity.AuthenticationRecord> Azure.Identity.DeviceCodeCredential.AuthenticateAsync(Azure.Core.TokenRequestContext, System.Threading.CancellationToken)'.

PowerShell Version

PS > $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.4.5
PSEdition                      Core
GitCommitId                    7.4.5
OS                             Microsoft Windows 10.0.22631
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PS > $host

Name             : Visual Studio Code Host
Version          : 2024.2.2
InstanceId       : bfa40465-f731-49c5-8c6c-950b1358e6ae
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-SE
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

PS >

Visual Studio Code Version

PS > code --version

1.93.1
38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40
x64

PS >

Extension Version

PS > code --list-extensions --show-versions | Select-String powershell

[email protected]

PS >

Steps to Reproduce

# Run in VSCode with the VSCode-PowerShell extension in the "PowerShell Extension" terminal = Crash
Microsoft.Graph.Authentication\Connect-MgGraph -ContextScope 'Process' -NoWelcome -UseDeviceCode -Scopes (
    'PrivilegedAccess.Read.AzureADGroup',
    'PrivilegedEligibilitySchedule.Read.AzureADGroup'
)

Visuals

No response

Logs

No response

@o-l-a-v o-l-a-v added Issue-Bug A bug to squash. Needs: Triage Maintainer attention needed! labels Sep 30, 2024
Copy link

We've found some similar issues:

If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.

Note: You can give me feedback by 👍 or 👎 this comment.

@JustinGrote
Copy link
Collaborator

JustinGrote commented Sep 30, 2024

Thanks for your submission!
I'm going to mark as dupe of #4727 as the method error is a dead giveaway you are having an assembly conflict. See the detailed comments for why this is a tricky issue to "solve" within the context of the vscode extension.

@JustinGrote
Copy link
Collaborator

JustinGrote commented Sep 30, 2024

@o-l-a-v as a community member I cannot answer that question, but the Az, Microsoft.Graph, and Vscode-powershell team members are part of separate organizations within Microsoft.

I want to be clear I closed it as a duplicate of the other issue, but the other issue is open and is definitely a known thing we'd like to address if possible, because it frustrates me just as much as it does you too :)

PowerShell is fairly unique as a .NET application by having "plug-ins" in the forms of modules, and the tools to isolate those dependencies and make them play nice with each other aren't super mature in .NET just by virtue of most people not needing them, either because they use an IPC for communication between different .NET processes, or plugins are forced to use the same assemblies.

CC @andyleejordan @SteveL-MSFT

@o-l-a-v
Copy link
Contributor Author

o-l-a-v commented Sep 30, 2024

I deleted the comment @JustinGrote replied to as I started doing deeper research into where I should send this feedback. For context, here is what I wrote:


I quickly read through linked thread. Seems Az has issues with vscode-powershell due to inproper dependency isolation. Microsoft.Graph too then I guess.

It's easy to close this vscode-powershell issue and blame it on other parts of the stack. And it might not be up to vscode-powershell to solve, I get that.

What I then want to know is: What's the progress on having Microsoft modules play nice with the Microsoft official way of authoring PowerShell scripts these days? Do you have any insight on that?

This should probably be a combined effort between vscode-powershell, Az and Microsoft.Graph authors/maintainers.

The experience of using VSCode with a regular pwsh terminal is not as nice. Many times running multiple lines in a script file with F8 fails, because all info did not get sent to the terminal before it tries to execute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug A bug to squash. Needs: Triage Maintainer attention needed!
Projects
None yet
Development

No branches or pull requests

2 participants