{"record":{"id":"4f412d3329d47977","repo":"dotnet/BenchmarkDotNet","slug":"there-is-no-default-resolver-for-characteristic-f","errorCode":null,"errorMessage":"There is no default resolver for {characteristic.FullId}","messagePattern":"There is no default resolver for (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/BenchmarkDotNet/Characteristics/CompositeResolver.cs","lineNumber":24,"sourceCode":"    {\n        private readonly IResolver[] resolvers;\n\n        public CompositeResolver(params IResolver[] resolvers)\n        {\n            this.resolvers = resolvers;\n        }\n\n        public bool CanResolve(Characteristic characteristic) => resolvers.Any(r => r.CanResolve(characteristic));\n\n        public object? Resolve(CharacteristicObject obj, Characteristic characteristic)\n        {\n            if (obj.HasValue(characteristic))\n                return characteristic[obj];\n\n            var resolver = resolvers.FirstOrDefault(r => r.CanResolve(characteristic));\n            if (resolver != null)\n                return resolver.Resolve(obj, characteristic);\n            throw new InvalidOperationException($\"There is no default resolver for {characteristic.FullId}\");\n        }\n\n        public T? Resolve<[DynamicallyAccessedMembers(CharacteristicObject.CharacteristicMemberTypes)] T>(CharacteristicObject obj, Characteristic<T> characteristic)\n        {\n            if (obj.HasValue(characteristic))\n                return characteristic[obj];\n\n            var resolver = resolvers.FirstOrDefault(r => r.CanResolve(characteristic));\n            if (resolver != null)\n                return resolver.Resolve(obj, characteristic);\n            throw new InvalidOperationException($\"There is no default resolver for {characteristic.FullId}\");\n        }\n\n        public object? Resolve(CharacteristicObject obj, Characteristic characteristic, object defaultValue)\n        {\n            if (obj.HasValue(characteristic))\n                return characteristic[obj];\n","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/dotnet/BenchmarkDotNet/blob/b515068b61ad1c9c9aa938b8ece4af1e7d6d85a3/src/BenchmarkDotNet/Characteristics/CompositeResolver.cs#L6-L42","documentation":"CompositeResolver.Resolve(CharacteristicObject, Characteristic) throws when the object does not already hold a value for the requested characteristic AND none of the resolvers in its chain can resolve it. CompositeResolver aggregates several IResolver instances (job/runtime/infrastructure resolvers) and resolves a characteristic by delegating to the first capable resolver; if the list is empty for that characteristic, there is no way to produce a default.","triggerScenarios":"Calling obj.ResolveValue / Job.ResolveValue for a characteristic that was never set and for which no resolver (e.g. InfrastructureResolver, RuntimeResolver, JobResolver) was registered in the composite. Building a custom CompositeResolver whose resolver list omits the resolver that owns a given characteristic.","commonSituations":"Creating a hand-rolled resolver chain for tests or a custom hosting scenario, referencing a characteristic that only exists in a newer/older BDN version than the resolvers you wired up, or mutating a Job's resolver set after construction.","solutions":["Ensure the resolver you pass to the CompositeResolver can resolve the characteristic (call CanResolve on it) before relying on Resolve.","Set an explicit value on the characteristic (e.g. job.WithRuntime(...)) so the HasValue short-circuit applies instead of resolver lookup.","Add the missing resolver (typically the framework/runtime/infrastructure default resolver) to the composite.","If you do not need a value, call the Resolve(obj, characteristic, defaultValue) overload that returns a default instead of throwing."],"exampleFix":"// before\nvar value = composite.Resolve(job, SomeCharacteristic);\n\n// after\nif (composite.CanResolve(SomeCharacteristic))\n    var value = composite.Resolve(job, SomeCharacteristic);\nelse\n    job = job.With(SomeCharacteristic, fallbackValue);","handlingStrategy":"validation","validationCode":"if (!composite.CanResolve(characteristic))\n    throw new InvalidOperationException($\"Caller must set '{characteristic.Id}' before resolve.\");\nvar value = composite.Resolve(obj, characteristic);","typeGuard":"bool CanResolveSafely(CompositeResolver r, Characteristic c) => r.CanResolve(c);","tryCatchPattern":"try { return composite.Resolve(obj, characteristic); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"no default resolver\"))\n{\n    // set a sensible default or rethrow with context about the missing characteristic\n}","preventionTips":["Always include the resolver that owns a characteristic when building a CompositeResolver.","Set explicit values on characteristics you depend on rather than relying on resolver defaults.","Prefer the Resolve(obj, characteristic, defaultValue) overload when a fallback is acceptable."],"tags":["characteristics","resolver","job-config","invalidoperation"],"backgroundTag":null,"analyzedSha":"b515068b61ad1c9c9aa938b8ece4af1e7d6d85a3","analyzedAt":"2026-08-13T19:12:24.196Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}