{"record":{"id":"7689eebe7a69a40c","repo":"Unity-Technologies/UnityCsReference","slug":"resolver","errorCode":null,"errorMessage":"resolver","messagePattern":"resolver","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/Handles/HandleUtility.cs","lineNumber":104,"sourceCode":"            return renderPickingType == RenderPickingType.RenderFromFilterSet ? contained : !contained;\n        }\n    }\n\n    public readonly struct RenderPickingResult\n    {\n        public int renderedPickingIndexCount { get; }\n        public HandleUtility.ResolvePickingCallback resolver { get; }\n        public HandleUtility.ResolvePickingWithWorldPositionCallback resolverWithWorldPos { get; }\n\n        [NoAutoStaticsCleanup] // default struct value; no mutable state\n        public static readonly RenderPickingResult NoOperation = default;\n\n        public RenderPickingResult(int renderedPickingIndexCount, HandleUtility.ResolvePickingCallback resolver)\n        {\n            if (renderedPickingIndexCount < 0)\n                throw new ArgumentOutOfRangeException(nameof(renderedPickingIndexCount), $\"The value ({renderedPickingIndexCount}) must not be negative\");\n            if (resolver == null)\n                throw new ArgumentNullException(nameof(resolver));\n\n            this.renderedPickingIndexCount = renderedPickingIndexCount;\n            this.resolver = resolver;\n            this.resolverWithWorldPos = null;\n        }\n\n        public RenderPickingResult(int renderedPickingIndexCount, HandleUtility.ResolvePickingWithWorldPositionCallback resolver)\n        {\n            if (renderedPickingIndexCount < 0)\n                throw new ArgumentOutOfRangeException(nameof(renderedPickingIndexCount), $\"The value ({renderedPickingIndexCount}) must not be negative\");\n            if (resolver == null)\n                throw new ArgumentNullException(nameof(resolver));\n\n            this.renderedPickingIndexCount = renderedPickingIndexCount;\n            this.resolverWithWorldPos = resolver;\n            this.resolver = null;\n        }\n    }","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/Handles/HandleUtility.cs#L86-L122","documentation":"The RenderPickingResult constructor requires a non-null resolver callback because the picking system must be able to map a picked index back to a concrete handle; a null resolver would cause a NullReferenceException later during picking resolution. Both overloads therefore throw ArgumentNullException(nameof(resolver)).","triggerScenarios":"Constructing RenderPickingResult(count, null) for either overload; passing a delegate field that was never assigned; conditional code paths that build the result but forget to supply the callback.","commonSituations":"Custom handle that returns a picking result without a real resolve handler; refactor that moved the callback into a separate field left null; editor extension wiring up picking incompletely.","solutions":["Always pass a non-null resolver (a static no-op delegate if picking is intentionally inert).","Use RenderPickingResult.NoOperation when you have no picking to declare, instead of constructing with a null callback.","Initialize resolver delegate fields to a default implementation to avoid accidental nulls."],"exampleFix":"// before\nreturn new RenderPickingResult(count, null);\n\n// after\nreturn count == 0 ? RenderPickingResult.NoOperation : new RenderPickingResult(count, ResolvePicking);","handlingStrategy":"validation","validationCode":"if (resolver == null) return RenderPickingResult.NoOperation;\nreturn new RenderPickingResult(count, resolver);","typeGuard":"static bool HasResolver(HandleUtility.ResolvePickingCallback r) => r != null;","tryCatchPattern":null,"preventionTips":["Always supply a non-null resolver delegate.","Use RenderPickingResult.NoOperation when picking is inert.","Initialize resolver fields to a default no-op implementation."],"tags":["handles","picking","null-argument","editor-scripting","validation"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}