stride3d/stride · error · ArgumentException

A part Id cannot be empty.

Error message

A part Id cannot be empty.

What it means

The AssetPart constructor validates that partId is not Guid.Empty and throws ArgumentException. An AssetPart identifies a sub-part of an asset by a Guid, so an empty Guid would make the part unreferenceable. The struct is marked Obsolete.

Solutions

  1. Generate a valid id with Guid.NewGuid() before constructing the AssetPart.
  2. Fix the data source so part ids are always populated before this constructor is called.
  3. Migrate away from the obsolete AssetPart struct to the API that replaces it.

Example fix

// before
var part = new AssetPart(Guid.Empty, base, updater);
// after
var part = new AssetPart(Guid.NewGuid(), base, updater);
Defensive patterns

Strategy: validation

Validate before calling

if (partId == Guid.Empty) throw new ArgumentException("Part id must be a non-empty Guid before constructing AssetPart");

Type guard

bool HasValidPartId(Guid id) => id != Guid.Empty;

Prevention

When it happens

Trigger: Calling new AssetPart(Guid.Empty, basePart, baseUpdater) — i.e. constructing a part without assigning it a real Guid.

Common situations: Code creating parts from deserialized data where the id field was never populated; default-struct initialization patterns that leave the Guid at Guid.Empty.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/99351bf0d478e229. Report an issue: GitHub.

Appendix: source

Thrown at sources/assets/Stride.Core.Assets/AssetPart.cs:16

// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.

namespace Stride.Core.Assets;

/// <summary>
/// A part asset contained by an asset that is <see cref="IAssetComposite"/>.
/// </summary>
[DataContract("AssetPart")]
[Obsolete("This struct might be removed soon")]
public readonly struct AssetPart : IEquatable<AssetPart>
{
    public AssetPart(Guid partId, BasePart? basePart, Action<BasePart> baseUpdater)
    {
        ArgumentNullException.ThrowIfNull(baseUpdater);
        if (partId == Guid.Empty) throw new ArgumentException("A part Id cannot be empty.", nameof(partId));
        PartId = partId;
        Base = basePart;
        this.baseUpdater = baseUpdater;
    }

    /// <summary>
    /// Asset identifier.
    /// </summary>
    public readonly Guid PartId;

    /// <summary>
    /// Base asset identifier.
    /// </summary>
    public readonly BasePart? Base;

    private readonly Action<BasePart> baseUpdater;

    public readonly void UpdateBase(BasePart newBase)

View on GitHub (pinned to 96fad776d2)