stride3d/stride · error · ArgumentNullException
ArgumentNullException: descriptions
Error message
ArgumentNullException: descriptions
What it means
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.
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.
Example fix
// before
var shape = PhysicsColliderShape.New(colliderDescs); // colliderDescs is null
// after
if (colliderDescs == null || colliderDescs.Length == 0) { Log.Warning("No collider descriptions"); return null; }
var shape = PhysicsColliderShape.New(colliderDescs); Defensive patterns
Strategy: type-guard
Validate before calling
if (descriptions == null || descriptions.Length == 0) return null;
Type guard
bool HasDescriptions(IAssetColliderShapeDesc[] d) => d != null && d.Length > 0;
Try / catch
try { shape = PhysicsColliderShape.New(descs); } catch (ArgumentNullException) { shape = null; } Prevention
- Build desc arrays from validated assets only
- Check asset load results before shape creation
- Avoid reflection paths that can pass null params arrays
When it happens
Trigger: Calling PhysicsColliderShape.New(null); passing a variable that is a null desc array, e.g. from a failed asset load or an uninitialized field.
Common situations: 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.
Related errors
- ArgumentNullException
- Array is null
- Destination array cannot be null.
- This Collidable's should exist
- Entity on this instance
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/98de0444a29bd6f3.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Physics/Engine/PhysicsColliderShape.cs:46
{
Descriptions.AddRange(descriptions);
}
/// <summary>
/// Used to serialize one or more collider shapes into one single shape
/// Reading this value will automatically parse the Shape property into its description
/// Writing this value will automatically compose, create and populate the Shape property
/// </summary>
[DataMember]
public List<IAssetColliderShapeDesc> Descriptions { get; } = new List<IAssetColliderShapeDesc>();
[DataMemberIgnore]
public ColliderShape Shape { get; internal set; }
[NotNull]
public static PhysicsColliderShape New([NotNull] params IAssetColliderShapeDesc[] descriptions)
{
if (descriptions == null) throw new ArgumentNullException(nameof(descriptions));
return new PhysicsColliderShape(descriptions);
}
internal static ColliderShape Compose(IReadOnlyList<IAssetColliderShapeDesc> descs, IServiceRegistry assetManager)
{
if (descs == null)
{
return null;
}
ColliderShape res = null;
if (descs.Count == 1) //single shape case
{
res = descs[0].CreateShape(assetManager);
if (res == null) return null;
res.IsPartOfAsset = true;
}View on GitHub (pinned to 96fad776d2)