Microsoft.Graph.Authentication fails after removal and re-import in the same PowerShell session
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
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
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
- Fournit un Dockerfile ou un fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de microsoftgraph/msgraph-sdk-powershell
-
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
microsoftgraph/msgraph-sdk-powershell#3752 ·
Les mainteneurs répondent en général sous 1 jour
-
status:waiting-for-triage type:bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
microsoftgraph/msgraph-sdk-powershell#3751 ·
Les mainteneurs répondent en général sous 1 jour
-
Supported way to get the tokenOuvertestatus:waiting-for-triage type:feature
Difficulté 4/5 3-5 jours Accessibilité débutants 45/100
microsoftgraph/msgraph-sdk-powershell#3806 · 1 commentaire · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
status:waiting-for-triage type:bug
Difficulté 3/5 1-2 jours Accessibilité débutants 72/100
microsoftgraph/msgraph-sdk-powershell#3772 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
microsoftgraph/msgraph-sdk-powershell#3749 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de microsoftgraph/msgraph-sdk-powershell
Issues similaires
-
bug P3
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
nightscout/nocturne#1908 ·
Les mainteneurs répondent en général sous 1 jour
-
bug documentation Needs: Triage :mag:
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
-
WPF: each page's `Title` overwrites the window title, and returning to a page does not restore itOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
Les mainteneurs répondent en général sous 1 jour
-
agentic-workflows area/Docs partner/agentic-workflows
Difficulté 1/5 Moins d'une heure Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
jamesmontemagno/tiny-clips#378 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour