{"record":{"id":"99351bf0d478e229","repo":"stride3d/stride","slug":"a-part-id-cannot-be-empty","errorCode":null,"errorMessage":"A part Id cannot be empty.","messagePattern":"A part Id cannot be empty\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/assets/Stride.Core.Assets/AssetPart.cs","lineNumber":16,"sourceCode":"// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)\n// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.\n\nnamespace Stride.Core.Assets;\n\n/// <summary>\n/// A part asset contained by an asset that is <see cref=\"IAssetComposite\"/>.\n/// </summary>\n[DataContract(\"AssetPart\")]\n[Obsolete(\"This struct might be removed soon\")]\npublic readonly struct AssetPart : IEquatable<AssetPart>\n{\n    public AssetPart(Guid partId, BasePart? basePart, Action<BasePart> baseUpdater)\n    {\n        ArgumentNullException.ThrowIfNull(baseUpdater);\n        if (partId == Guid.Empty) throw new ArgumentException(\"A part Id cannot be empty.\", nameof(partId));\n        PartId = partId;\n        Base = basePart;\n        this.baseUpdater = baseUpdater;\n    }\n\n    /// <summary>\n    /// Asset identifier.\n    /// </summary>\n    public readonly Guid PartId;\n\n    /// <summary>\n    /// Base asset identifier.\n    /// </summary>\n    public readonly BasePart? Base;\n\n    private readonly Action<BasePart> baseUpdater;\n\n    public readonly void UpdateBase(BasePart newBase)","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/assets/Stride.Core.Assets/AssetPart.cs#L1-L34","documentation":"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.","triggerScenarios":"Calling new AssetPart(Guid.Empty, basePart, baseUpdater) — i.e. constructing a part without assigning it a real Guid.","commonSituations":"Code creating parts from deserialized data where the id field was never populated; default-struct initialization patterns that leave the Guid at Guid.Empty.","solutions":["Generate a valid id with Guid.NewGuid() before constructing the AssetPart.","Fix the data source so part ids are always populated before this constructor is called.","Migrate away from the obsolete AssetPart struct to the API that replaces it."],"exampleFix":"// before\nvar part = new AssetPart(Guid.Empty, base, updater);\n// after\nvar part = new AssetPart(Guid.NewGuid(), base, updater);","handlingStrategy":"validation","validationCode":"if (partId == Guid.Empty) throw new ArgumentException(\"Part id must be a non-empty Guid before constructing AssetPart\");","typeGuard":"bool HasValidPartId(Guid id) => id != Guid.Empty;","tryCatchPattern":null,"preventionTips":["Default new part ids to Guid.NewGuid(), never Guid.Empty.","Validate ids when deserializing part data.","Prefer the replacement API since AssetPart is Obsolete."],"tags":["assets","guid","argument"],"backgroundTag":"invalid-argument-value","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"}