You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am attempting to rationalise our PowerShell logging technique across numerous scripts, but have encountered an unfortunate conflict with the Microsoft module Pnp.PowerShell.
System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Could not find or load a specific file. (0x80131621)
File name: 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
---> System.IO.FileLoadException: Assembly with same name is already loaded
at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyLoadContext, String ilPath, String niPath, ObjectHandleOnStack retAssembly)
at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at System.Reflection.Assembly.LoadFromResolveHandler(Object sender, ResolveEventArgs args)
at System.Runtime.Loader.AssemblyLoadContext.InvokeResolveEvent(ResolveEventHandler eventHandler, RuntimeAssembly assembly, String name)
at System.Runtime.Loader.AssemblyLoadContext.OnAssemblyResolve(RuntimeAssembly assembly, String assemblyFullName)
at PnP.Framework.Http.PnPHttpClient.BuildServiceFactory()
at PnP.Framework.Http.PnPHttpClient..ctor()
at PnP.Framework.Http.PnPHttpClient.<>c.<.cctor>b__15_0()
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
--- End of stack trace from previous location where exception was thrown ---
at System.Lazy`1.CreateValue()
at PnP.Framework.Http.PnPHttpClient.get_Instance()
at PnP.Framework.Http.MsalHttpClientFactory.GetHttpClient()
at Microsoft.Identity.Client.Http.HttpManager.GetHttpClient()
at Microsoft.Identity.Client.Http.HttpManager.ExecuteAsync(Uri endpoint, IDictionary`2 headers, HttpContent body, HttpMethod method, ICoreLogger logger, CancellationToken cancellationToken)
at Microsoft.Identity.Client.Http.HttpManager.ExecuteWithRetryAsync(Uri endpoint, IDictionary`2 headers, HttpContent body, HttpMethod method, ICoreLogger logger, Boolean doNotThrow, Boolean retry, CancellationToken cancellationToken)
at Microsoft.Identity.Client.Http.HttpManager.SendGetAsync(Uri endpoint, IDictionary`2 headers, ICoreLogger logger, Boolean retry, CancellationToken cancellationToken)
at Microsoft.Identity.Client.OAuth2.OAuth2Client.ExecuteRequestAsync[T](Uri endPoint, HttpMethod method, RequestContext requestContext, Boolean expectErrorsOn200OK, Boolean addCommonHeaders)
at Microsoft.Identity.Client.OAuth2.OAuth2Client.DiscoverAadInstanceAsync(Uri endPoint, RequestContext requestContext)
at Microsoft.Identity.Client.Instance.Discovery.NetworkMetadataProvider.SendInstanceDiscoveryRequestAsync(Uri authority, RequestContext requestContext)
at Microsoft.Identity.Client.Instance.Discovery.NetworkMetadataProvider.FetchAllDiscoveryMetadataAsync(Uri authority, RequestContext requestContext)
at Microsoft.Identity.Client.Instance.Discovery.NetworkMetadataProvider.GetMetadataAsync(Uri authority, RequestContext requestContext)
at Microsoft.Identity.Client.Instance.Discovery.InstanceDiscoveryManager.FetchNetworkMetadataOrFallbackAsync(RequestContext requestContext, Uri authorityUri)
at Microsoft.Identity.Client.Instance.Discovery.InstanceDiscoveryManager.GetMetadataEntryAsync(AuthorityInfo authorityInfo, RequestContext requestContext, Boolean forceValidation)
at Microsoft.Identity.Client.Instance.AuthorityManager.RunInstanceDiscoveryAndValidationAsync()
at Microsoft.Identity.Client.Internal.Requests.UsernamePasswordRequest.ExecuteAsync(CancellationToken cancellationToken)
at Microsoft.Identity.Client.Internal.Requests.RequestBase.RunAsync(CancellationToken cancellationToken)
at Microsoft.Identity.Client.ApiConfig.Executors.PublicClientExecutor.ExecuteAsync(AcquireTokenCommonParameters commonParameters, AcquireTokenByUsernamePasswordParameters usernamePasswordParameters, CancellationToken cancellationToken)
at PnP.Framework.AuthenticationManager.GetContextAsync(String siteUrl, CancellationToken cancellationToken)
at PnP.Framework.AuthenticationManager.GetContext(String siteUrl)
at PnP.PowerShell.Commands.Base.PnPConnection.CreateWithCredentials(Cmdlet cmdlet, Uri url, PSCredential credentials, Boolean currentCredentials, String tenantAdminUrl, AzureEnvironment azureEnvironment, String clientId, String redirectUrl, Boolean onPrem, InitializationType initializationType) in c:\build\src\Commands\Base\PnPConnection.cs:line 372
at PnP.PowerShell.Commands.Base.ConnectOnline.ConnectCredentials(PSCredential credentials, InitializationType initializationType) in c:\build\src\Commands\Base\ConnectOnline.cs:line 514
at PnP.PowerShell.Commands.Base.ConnectOnline.Connect(CancellationToken& cancellationToken) in c:\build\src\Commands\Base\ConnectOnline.cs:line 260
at PnP.PowerShell.Commands.Base.ConnectOnline.ProcessRecord() in c:\build\src\Commands\Base\ConnectOnline.cs:line 210
at System.Management.Automation.CommandProcessor.ProcessRecord()
PoShLog is pretty awesome and I would very much like to utilise wherever possible - Please do advise whether we have any option to workaround this issue.
The text was updated successfully, but these errors were encountered:
Hi, I think I've seen similar issue in past, but unfortunately so far I don't have resolution for it.
I'm gonna need some time to figure it out. 😅 Or perhaps someone else can help with this? 🆘
Many thanks for coming back so quickly, I realise this may not be a quick fix. Still working my way though the following article, but it makes for interesting (and hopefully promising) reading.
I am attempting to rationalise our PowerShell logging technique across numerous scripts, but have encountered an unfortunate conflict with the Microsoft module Pnp.PowerShell.
PoShLog is pretty awesome and I would very much like to utilise wherever possible - Please do advise whether we have any option to workaround this issue.
The text was updated successfully, but these errors were encountered: