dotnet/BenchmarkDotNet · error · InvalidOperationException
Type {0}: no property or field {1} found.
Error message
Type {0}: no property or field {1} found. What it means
InProcessNoEmitRunner reflects over the target type to locate a property or field by name; no matching member was found.
Source
Thrown at src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/InProcessNoEmitRunner.cs:87
/// <param name="benchmarkCase">The benchmark.</param>
/// <param name="cancellationToken">The cancellation token to inject into members marked with [BenchmarkCancellation].</param>
internal static void FillMembers(object instance, BenchmarkCase benchmarkCase, CancellationToken cancellationToken)
{
var targetType = benchmarkCase.Descriptor.Type;
// Fill parameter values
foreach (var parameter in benchmarkCase.Parameters.Items)
{
var flags = BindingFlags.Public;
flags |= parameter.IsStatic ? BindingFlags.Static : BindingFlags.Instance;
var paramProperty = targetType.GetProperty(parameter.Name, flags);
if (paramProperty == null)
{
var paramField = targetType.GetField(parameter.Name, flags);
if (paramField == null)
throw new InvalidOperationException(
$"Type {targetType.FullName}: no property or field {parameter.Name} found.");
var callInstance = paramField.IsStatic ? null : instance;
paramField.SetValue(callInstance, parameter.Value);
}
else
{
var setter = paramProperty.GetSetMethod();
if (setter == null)
throw new InvalidOperationException(
$"Type {targetType.FullName}: no settable property {parameter.Name} found.");
var callInstance = setter.IsStatic ? null : instance;
setter.Invoke(callInstance, [parameter.Value]);
}
}
// Inject CancellationToken into properties/fields marked with [BenchmarkCancellation]View on GitHub (pinned to b515068b61)
Solutions
- Check the property/field name passed in the configuration for typos and correct casing.
- Ensure the member exists on the benchmark instance type and is accessible (public, or accessible from the runner).
- If the member was renamed or removed, update the configuration string accordingly.
When it happens
Trigger: Thrown at src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/InProcessNoEmitRunner.cs:87 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of dotnet/BenchmarkDotNet@b515068b61 (2026-08-13).
Data as JSON: /api/errors/e74a0f6e31f8ed9e.
Report an issue: GitHub.