Microsoft.Graph.Authentication fails after removal and re-import in the same PowerShell session
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 25/100
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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_
- Vorherrschende Sprache
- C#
- Sterne
- 904
- Forks
- 235
- Ø Merge
- 1 T. 23 Std.
- Gemergte PRs (30 T.)
- 22
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus microsoftgraph/msgraph-sdk-powershell
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
microsoftgraph/msgraph-sdk-powershell#3752 ·
Maintainer antworten meist innerhalb von 1 Tag
-
status:waiting-for-triage type:bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 55/100
microsoftgraph/msgraph-sdk-powershell#3831 ·
Maintainer antworten meist innerhalb von 1 Tag
-
status:waiting-for-triage type:feature
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 8/100
microsoftgraph/msgraph-sdk-powershell#3827 ·
Maintainer antworten meist innerhalb von 1 Tag
-
status:waiting-for-triage type:bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 22/100
microsoftgraph/msgraph-sdk-powershell#3822 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Connect-MgGraph on 2.41 crashes when making a connection with cert, fixes when using 2.39 or lowerOffenstatus:waiting-for-triage type:bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
microsoftgraph/msgraph-sdk-powershell#3816 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in microsoftgraph/msgraph-sdk-powershell
Ähnliche Issues
-
good first issue help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
-
untriaged
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
dotnet/dotnet-api-docs#13210 ·
Maintainer antworten meist innerhalb von 1 Tag
-
aspnet-core/svc doc-enhancement mvc/subsvc Pri2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
dotnet/AspNetCore.Docs#38016 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
HicServices/RDMP#2398 ·
-
area-drawing platform/android t/bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
dotnet/maui#39676 · 1 Kommentar · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag