From 0e5d653176e9a85495338ff29528602e488f51eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20K=C5=82ys?= Date: Fri, 5 Jun 2026 08:26:32 +0200 Subject: [PATCH] Address auth ALC review comments --- .../Authentication/Microsoft.Graph.Authentication.psm1 | 4 ++-- .../test/Microsoft.Graph.Authentication.Tests.ps1 | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Authentication/Authentication/Microsoft.Graph.Authentication.psm1 b/src/Authentication/Authentication/Microsoft.Graph.Authentication.psm1 index 77d328013c..bb6b404a4c 100644 --- a/src/Authentication/Authentication/Microsoft.Graph.Authentication.psm1 +++ b/src/Authentication/Authentication/Microsoft.Graph.Authentication.psm1 @@ -53,7 +53,7 @@ namespace Microsoft.Graph.PowerShell.Authentication.Loader private static Assembly Resolve(AssemblyLoadContext context, AssemblyName assemblyName) { - if (context == null || assemblyName == null) + if (context == null || assemblyName == null || string.IsNullOrWhiteSpace(assemblyName.Name)) { return null; } @@ -91,7 +91,7 @@ function Import-GraphAuthenticationAssembly { ) if ($PSEdition -ne 'Core' -or -not ('System.Runtime.Loader.AssemblyLoadContext' -as [type])) { - return Import-Module -Name $ModulePath -PassThru + return Import-Module -LiteralPath $ModulePath -PassThru } $loadContextName = Get-GraphAuthenticationLoadContextName -ModulePath $ModulePath diff --git a/src/Authentication/Authentication/test/Microsoft.Graph.Authentication.Tests.ps1 b/src/Authentication/Authentication/test/Microsoft.Graph.Authentication.Tests.ps1 index 87420fe05b..f39421a7df 100644 --- a/src/Authentication/Authentication/test/Microsoft.Graph.Authentication.Tests.ps1 +++ b/src/Authentication/Authentication/test/Microsoft.Graph.Authentication.Tests.ps1 @@ -117,9 +117,7 @@ public static class GraphAuthenticationAssemblyLoadContextTestHelper $dependencyAssembly.GetName().Name | Should -Be 'Azure.Core' $dependencyContext.Name | Should -Be $loadContext.Name - [System.Runtime.Loader.AssemblyLoadContext]::Default.Assemblies | - Where-Object { $_.GetName().Name -eq 'Azure.Core' } | - Should -BeNullOrEmpty + [object]::ReferenceEquals($dependencyContext, [System.Runtime.Loader.AssemblyLoadContext]::Default) | Should -BeFalse } } }