diff --git a/src/client/Microsoft.Identity.Client/PlatformsCommon/Shared/AbstractPlatformProxy.cs b/src/client/Microsoft.Identity.Client/PlatformsCommon/Shared/AbstractPlatformProxy.cs index d6a2b488a2..c906c336de 100644 --- a/src/client/Microsoft.Identity.Client/PlatformsCommon/Shared/AbstractPlatformProxy.cs +++ b/src/client/Microsoft.Identity.Client/PlatformsCommon/Shared/AbstractPlatformProxy.cs @@ -61,7 +61,11 @@ private IOtelInstrumentation InternalGetOtelInstrumentation() try { return new OtelInstrumentation(); - } catch (FileNotFoundException ex) + } + catch (Exception ex) + when (ex is FileNotFoundException + or TypeLoadException + or TypeInitializationException) { // Can happen in in-process Azure Functions: https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/issues/4456 Logger.Warning("Failed instantiating OpenTelemetry instrumentation. Exception: " + ex.Message); @@ -247,3 +251,4 @@ internal virtual IManagedIdentityKeyProvider GetManagedIdentityKeyProvider() public IManagedIdentityKeyProvider ManagedIdentityKeyProvider => _miKeyProvider.Value; } } +