Skip to content

Bug: HAWK 4.0 fails to load with TypeLoadException when Microsoft.Graph modules newer than 2.25.0 are present #306

Description

@aaron-aanda

What happened?

OS: Windows 11
PowerShell: 5.1.26100.8655
HAWK Version: 4.0 (fresh install)
Microsoft.Graph.Authentication at time of failure: 2.38.0

Description:
On a machine that already has Microsoft.Graph modules installed at a version newer than 2.25.0, Import-Module HAWK fails immediately with a TypeLoadException. The machine is used for other PowerShell and Graph-dependent workflows, so newer Graph modules were already present when HAWK was installed fresh.

Error:
Import-Module : Method 'GetTokenAsync' in type
'Microsoft.Graph.PowerShell.Authentication.Core.Utilities.UserProvidedTokenCredential' from assembly
'Microsoft.Graph.Authentication.Core, Version=2.38.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not
have an implementation.

Current Workaround:
Reboot the machine to release file locks on the Graph DLLs, then manually delete all Microsoft.Graph.* module folders newer than 2.25.0 from C:\Program Files\WindowsPowerShell\Modules. This is destructive to other tools on the same machine that depend on newer Graph module versions and is not a viable long-term solution.

Expected Behavior:
HAWK should load successfully on a machine that has newer Microsoft.Graph modules installed, or the installation process should handle Graph module version conflicts gracefully rather than silently installing in a broken state.

Steps to Reproduce

Install Microsoft.Graph modules at any version newer than 2.25.0
Install HAWK 4.0 fresh via Install-Module HAWK
Run Import-Module HAWK
Observe TypeLoadException

Hawk Version

4.0

Technical Analysis

No response

Implementation Plan

No response

Acceptance Criteria

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    status/backlogIn backlog / validatedtype/bugNon-urgent code defect

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions