ExchangeOnlineManagement - Exception in Assembly

ExchangeOnlineManagement - Exception in Assembly

avatar
Product: PowerShell Universal
Version: 4.4.1
OS: W2K22


Hi,

I’m trying to use the ExchangeOnlineManagement Module for PSU in a 5.1 environment but it fails with an assembly error and I cannot find a existing topic which has the same errors as mine.

The error that occurs is:

	
Exception: Der Typ "System.Diagnostics.Metrics.Meter" in der Assembly "System.Diagnostics.DiagnosticSource, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" konnte nicht geladen werden.
bei Connect-ExchangeOnline<Process>, C:\Program Files\WindowsPowerShell\Modules\ExchangeOnlineManagement\3.6.0\netFramework\ExchangeOnlineManagement.psm1: Zeile 762
bei <ScriptBlock>, <Keine Datei>: Zeile 4
bei <ScriptBlock>, <Keine Datei>: Zeile 1
System.TypeLoadException: Der Typ "System.Diagnostics.Metrics.Meter" in der Assembly "System.Diagnostics.DiagnosticSource, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" konnte nicht geladen werden.
   bei Microsoft.Identity.Client.Platforms.Features.OpenTelemetry.OtelInstrumentation..ctor()
   bei Microsoft.Identity.Client.PlatformsCommon.Shared.AbstractPlatformProxy.InternalGetOtelInstrumentation()
   bei System.Lazy`1.CreateValue()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Lazy`1.get_Value()
   bei Microsoft.Identity.Client.Internal.Requests.RequestBase.LogFailureTelemetryToOtel(String errorCodeToLog, ApiIds apiId, CacheRefreshReason cacheRefreshReason)
   bei Microsoft.Identity.Client.Internal.Requests.RequestBase.<RunAsync>d__11.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei Microsoft.Identity.Client.ApiConfig.Executors.PublicClientExecutor.<ExecuteAsync>d__5.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei Microsoft.Exchange.Management.AdminApiProvider.Authentication.MSALTokenProvider.<GetTokenForWebApiUsingUsernamePasswordAsync>d__32.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei Microsoft.Exchange.Management.AdminApiProvider.Authentication.MSALTokenProvider.<GetAccessTokenAsync>d__34.MoveNext()


The loaded assmebly is:

System.Diagnostics.DiagnosticSource, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51	file:///C:/System/WinSrvProg/Universal/Host/System.Diagnostics.DiagnosticSource.DLL


the code i use:

try {
    # I already tried to hardcode the credentials
    $Creds = Get-Credential
    Connect-ExchangeOnline -Credential $Creds

}
catch {
    $err = $_
    Write-Log -Error "Exception" -Exception $err
    Show-UDModal {
        $Assemblies = [AppDomain]::CurrentDomain.GetAssemblies() | Select-Object FullName, CodeBase
        New-UDTable -Data $Assemblies
   }
}


I’ve installed the module on the OS itself and not via PSU (restarted the service afterwards).
Also the other environments (Integrated, 7.4.2,…) do not work either.
Does anyone got an idea?

avatar

Recommended Answer

We updated to 5.2.2 and now it’s working

All Comments (2)

avatar

I have the exact same issue; also haven’t found a solution for this

avatar

We updated to 5.2.2 and now it’s working