From aa85d8c93eba64a19c7e9ed3c8df3f125bd16a5f Mon Sep 17 00:00:00 2001 From: Matt Chaulklin Date: Mon, 8 Jan 2024 15:43:41 -0500 Subject: [PATCH] Added new Exception --- src/BenchmarkDotNet/Diagnosers/DiagnosersLoader.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/BenchmarkDotNet/Diagnosers/DiagnosersLoader.cs b/src/BenchmarkDotNet/Diagnosers/DiagnosersLoader.cs index 1410aad8b..1e96f8e49 100644 --- a/src/BenchmarkDotNet/Diagnosers/DiagnosersLoader.cs +++ b/src/BenchmarkDotNet/Diagnosers/DiagnosersLoader.cs @@ -80,6 +80,11 @@ namespace BenchmarkDotNet.Diagnosers CreateDiagnoser(diagnosticsAssembly, "BenchmarkDotNet.Diagnostics.Windows.NativeMemoryProfiler") }; } + catch (Exception ex) when (ex is FileNotFoundException || ex is BadImageFormatException) + { + // Return an array of UnresolvedDiagnoser objects when the assembly does not contain the requested diagnoser + return new[] { GetUnresolvedDiagnoser() }; + } catch (Exception ex) // we're loading a plug-in, better to be safe rather than sorry { ConsoleLogger.Default.WriteLineError($"Error loading {WindowsDiagnosticAssemblyFileName}: {ex.GetType().Name} - {ex.Message}");