Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

Microsoft.Graph.Authentication fails after removal and re-import in the same PowerShell session

Ouverte
#3,805 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
25/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
À l'abandon
Stack technique
csharp, powershell
Domaine
devtools, tooling

Piste de recherche

Start with GraphLoadContextInitializer and the dependency-isolation changes from #3789, then reproduce the import/remove/re-import sequence in one PowerShell process. Regression coverage should verify subsequent command execution and load-context behavior, with the module continuing to resolve Microsoft.Graph.Authentication.Core after re-import.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

status:waiting-for-triage type:bug
Describe the bug

After the dependency-isolation changes introduced in #3789 , removing and re-importing Microsoft.Graph.Authentication in the same PowerShell 7+ session can leave dependency resolution broken.

Actual Behavior

Re-import or subsequent command execution can fail when resolving Microsoft.Graph.Authentication.Core.

Root Cause

Removing the module calls GraphLoadContextInitializer.Shutdown(), which unregisters the default-context resolver but retains the non-collectible private load context.

On re-import, Initialize() returns immediately because that context already exists, leaving the resolver unregistered. The binary module’s static constructor also does not run again.

Proposed Fix

Track resolver registration separately from context creation. Reuse the existing private context and re-register the resolver on subsequent imports.

Add regression coverage for importing, removing, and re-importing the module within one PowerShell process, followed by command execution and load-context assertions.

Fixed by PR: #3804

Expected behavior

The module can be removed and re-imported successfully, and its commands continue working with dependencies loaded into the private assembly load context.

How to reproduce

Using a build containing #3789 (v2.41):

Import-Module Microsoft.Graph.Authentication
Remove-Module Microsoft.Graph.Authentication
Import-Module Microsoft.Graph.Authentication
SDK Version

2.41.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output
Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_
Langage dominant
C#
Étoiles
901
Forks
232
Merge moyen
1 j 9 h
PR mergées (30 j)
22

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de microsoftgraph/msgraph-sdk-powershell

Toutes les issues de microsoftgraph/msgraph-sdk-powershell

Issues similaires

Plus d'issues C#

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.