Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#3,805 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
csharp, powershell
Área
devtools, tooling

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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_
Lenguaje dominante
C#
Estrellas
901
Forks
232
Merge medio
1 d 9 h
PR fusionados (30 d)
22

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoftgraph/msgraph-sdk-powershell

Todos los issues de microsoftgraph/msgraph-sdk-powershell

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.