diff --git a/src/BenchmarkDotNet/Diagnosers/DiagnosersLoader.cs b/src/BenchmarkDotNet/Diagnosers/DiagnosersLoader.cs index 1410aad8bc..1e96f8e495 100644 --- a/src/BenchmarkDotNet/Diagnosers/DiagnosersLoader.cs +++ b/src/BenchmarkDotNet/Diagnosers/DiagnosersLoader.cs @@ -80,6 +80,11 @@ private static IDiagnoser[] LoadWindowsDiagnosers() 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}");