Skip to content

2.26.0 Connect-MgGraph COMPLETELY BROKEN 'Could not load file or assembly System.Runtime' #3147

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

Closed
aglasson opened this issue Feb 20, 2025 · 4 comments
Assignees
Labels
Question: SDK type:bug A broken experience

Comments

@aglasson
Copy link

aglasson commented Feb 20, 2025

Describe the bug

Simply running Connect-MgGraph with the latest version produces the following error message. I've spent an almost 2 hours trying to get this to work on my system and its had me pulling my hair out.

Connect-MgGraph: Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

This is on my personal computer Windows 11 also tested the same result on one of my Server 2022 VMs.
I've tried:

  • Deleted and reinstalled the Microsoft.Graph module a bunch of times
  • Installing the latest .Net 8 Runtime
  • Installing the latest .Net 8 Desktop Runtime
  • Installing the latest .Net 8 SDK
  • Tried manually importanting System.Runtime.dll assembly
  • I've checked my Defender AV isn't catching something
  • I've change my ExecutionPolicy
  • Restarted Computer a couple of times
  • Run a thousand new powershell sessions after every attempted solution
  • Ran it on a different system and OS

Just my freaking luck that I've been using and installing MgGraph for 4-5 hours today for work and after work I go to fix something for my club on my home computer and a broken update of Microsoft.Graph just so happens to have been released in that time.
If it wasn't for me having been installing MgGraph just earlier today I might not have finally thought "I'm sure the latest version of MgGraph I installed just hours ago was 2.25.0".

Expected behavior

I get an interactive logon.

How to reproduce

  1. Install-Module -Name Microsoft.Graph
  2. Attempt to run Connect-MgGraph

SDK Version

2.26.0

Latest version known to work for scenario above?

No response

Known Workarounds

Roll back to 2.25.0.

Debug output

Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_
@aglasson aglasson added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Feb 20, 2025
@timayabi2020 timayabi2020 added Bug - P1 and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Feb 20, 2025
@timayabi2020
Copy link
Contributor

timayabi2020 commented Feb 20, 2025

Hi @aglasson sorry for the experience. I was not able to reproduce the issue as its working in both environments.
PowerShell 5
Image

PowerShell 7
Image

Image

Please try these steps.

  1. Uninstall-Module -Name Microsoft.Graph -AllVersions
  2. Install-Module -Name Microsoft.Graph -AllowClobber -Force
  3. Open a PowerShell session, run Connect-MgGraph and share the output of the following command [system.AppDomain]::CurrentDomain.GetAssemblies() | Where-Object Location | Sort-Object -Property FullName | Select-Object -Property FullName, Location | Out-GridView

@timayabi2020 timayabi2020 added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed Bug - P1 labels Feb 20, 2025
@aglasson
Copy link
Author

I have followed those steps. Here I am running it following them:
Image
Note, I have .Net 8 Runtime but not SDK (I had tried installing the SDK earlier with no success). .Net 8 (or 9 as per your screenshot) doesn't seem to be listed as a requirement for Microsoft.Graph anywhere. Yes I'm running a relatively old Powershell 7 as I've just had no need to update and I haven't used it on this computer in a while. The Microsoft.Graph requirements state anything newer than 5.1?

[system.AppDomain]::CurrentDomain.GetAssemblies() only lists:

System.Runtime, Version=6.0.0.0

This seems like the culprit, where does this DLL come from?

As soon as I delete 2.26.0 and install 2.25.0 Connect-MgGraph works fine everytime.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close labels Feb 20, 2025
@aglasson
Copy link
Author

Okay.. Updating to the latest Powershell 7 LTS (7.4.7) has fixed the problem. Thanks for the prompting to look into the GetAssemblies() that helped me think a bit deeper about the underlying cause.

This is in the release info of 2.26.0:

Drop unsupported net 6 and net 7 in #3078

I guess that correlates with Powershell 7.2 LTS going EOL November last year.

@timayabi2020
Copy link
Contributor

Yep. PowerShell 7.2 is built on .NET 6 and for security compliance reasons we dropped unsupported 6 and 7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question: SDK type:bug A broken experience
Projects
None yet
Development

No branches or pull requests

2 participants