Skip to content

Commit 41cbac8

Browse files
timayabi2020Timothy Wamalwapeombwa
authored
Removed null reference to Graph Instance environment after calling Invoke-MgGraph command (#1328)
* Reassigned _originalEnvironment variable to the previous user defined state instead of pointing to null * Corrected comment on Remove-MgEnvironment command Co-authored-by: Timothy Wamalwa <twamalwa@microsoft.com> Co-authored-by: Peter Ombwa <peombwa@microsoft.com>
1 parent e6d6732 commit 41cbac8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Authentication/Authentication/Cmdlets/InvokeMgGraphRequest.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,9 +1090,13 @@ private string QualifyFilePath(string path)
10901090

10911091
/// <summary>
10921092
/// Resets GraphSession environment back to its original state.
1093+
/// Original state can remain to be the previous state defined by the user,
1094+
/// or the default global state. User defined state can be removed by calling,
1095+
/// Remove-MgEnvironment Command
10931096
/// </summary>
10941097
private void ResetGraphSessionEnvironment()
10951098
{
1099+
_originalEnvironment = GraphSession.Instance.Environment;
10961100
GraphSession.Instance.Environment = _originalEnvironment;
10971101
}
10981102

0 commit comments

Comments
 (0)