{"record":{"id":"98de0444a29bd6f3","repo":"stride3d/stride","slug":"argumentnullexception-descriptions","errorCode":null,"errorMessage":"ArgumentNullException: descriptions","messagePattern":"ArgumentNullException: descriptions","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Physics/Engine/PhysicsColliderShape.cs","lineNumber":46,"sourceCode":"        {\n            Descriptions.AddRange(descriptions);\n        }\n\n        /// <summary>\n        /// Used to serialize one or more collider shapes into one single shape\n        /// Reading this value will automatically parse the Shape property into its description\n        /// Writing this value will automatically compose, create and populate the Shape property\n        /// </summary>\n        [DataMember]\n        public List<IAssetColliderShapeDesc> Descriptions { get; } = new List<IAssetColliderShapeDesc>();\n\n        [DataMemberIgnore]\n        public ColliderShape Shape { get; internal set; }\n\n        [NotNull]\n        public static PhysicsColliderShape New([NotNull] params IAssetColliderShapeDesc[] descriptions)\n        {\n            if (descriptions == null) throw new ArgumentNullException(nameof(descriptions));\n            return new PhysicsColliderShape(descriptions);\n        }\n\n        internal static ColliderShape Compose(IReadOnlyList<IAssetColliderShapeDesc> descs, IServiceRegistry assetManager)\n        {\n            if (descs == null)\n            {\n                return null;\n            }\n\n            ColliderShape res = null;\n\n            if (descs.Count == 1) //single shape case\n            {\n                res = descs[0].CreateShape(assetManager);\n                if (res == null) return null;\n                res.IsPartOfAsset = true;\n            }","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Physics/Engine/PhysicsColliderShape.cs#L28-L64","documentation":"PhysicsColliderShape.New(params IAssetColliderShapeDesc[]) composes a collider shape from one or more shape descriptions; a null descriptions array throws ArgumentNullException. Note an empty array is allowed, but individual null entries are handled later in Compose.","triggerScenarios":"Calling PhysicsColliderShape.New(null); passing a variable that is a null desc array, e.g. from a failed asset load or an uninitialized field.","commonSituations":"Asset pipeline failures leaving collider description lists null; custom tools constructing shapes from deserialized data that was missing; reflection-based instantiation passing no properly built args.","solutions":["Ensure at least one valid IAssetColliderShapeDesc is constructed before calling New.","Guard the call site against null description arrays and skip/defer shape creation.","Fix the asset that failed to deserialize its collider descriptions.","Use Compose defensively with a validated IReadOnlyList if composing manually."],"exampleFix":"// before\nvar shape = PhysicsColliderShape.New(colliderDescs); // colliderDescs is null\n// after\nif (colliderDescs == null || colliderDescs.Length == 0) { Log.Warning(\"No collider descriptions\"); return null; }\nvar shape = PhysicsColliderShape.New(colliderDescs);","handlingStrategy":"type-guard","validationCode":"if (descriptions == null || descriptions.Length == 0) return null;","typeGuard":"bool HasDescriptions(IAssetColliderShapeDesc[] d) => d != null && d.Length > 0;","tryCatchPattern":"try { shape = PhysicsColliderShape.New(descs); } catch (ArgumentNullException) { shape = null; }","preventionTips":["Build desc arrays from validated assets only","Check asset load results before shape creation","Avoid reflection paths that can pass null params arrays"],"tags":["csharp","null-reference","physics","collider-shape"],"backgroundTag":"null-argument","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}