stride3d/stride · error · ArgumentException

The guid must be different from Guid.Empty.

Error message

The guid must be different from Guid.Empty.

What it means

GraphNodeBase's constructor throws ArgumentException when given Guid.Empty, because every graph node needs a unique identifier for lookup and path resolution within the NodeContainer. A Guid.Empty node would be ambiguous and break node indexing.

Solutions

  1. Generate a real guid with Guid.NewGuid() (or the container's IGuidGenerator) before constructing the node
  2. Fix the IGuidGenerator/NodeFactory wiring so it never yields Guid.Empty
  3. Catch ArgumentException at node creation to report missing guid generation
  4. Use Debug.Assert(guid != Guid.Empty) early in custom factory code

Example fix

// before
var node = NodeFactory.CreateObjectNode(container, Guid.Empty, obj, descriptor);
// after
var node = NodeFactory.CreateObjectNode(container, Guid.NewGuid(), obj, descriptor);
Defensive patterns

Strategy: validation

Validate before calling

if (guid == Guid.Empty) throw new ArgumentException("Node guid must be generated", nameof(guid));

Try / catch

try { var node = factory.CreateObjectNode(container, guid, obj, desc); } catch (ArgumentException ex) when (ex.ParamName == "guid") { logger.LogError(ex, "Guid.Empty passed to node factory"); }

Prevention

When it happens

Trigger: Creating a GraphNode (ObjectNode, BoxedNode, MemberNode) with Guid.Empty — typically NodeFactory.CreateObjectNode/CreateBoxedNode invoked with an empty guid from a builder or custom factory.

Common situations: Generating identifiers via a source that returned Guid.Empty (e.g. IdProvider misconfigured, default(Guid) used); manually constructing nodes in tests without assigning a guid.

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/57097bb10f13286c. Report an issue: GitHub.

Appendix: source

Thrown at sources/presentation/Stride.Core.Quantum/GraphNodeBase.cs:19

// 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.

using System.Collections;
using Stride.Core.Reflection;
using Stride.Core.TypeConverters;

namespace Stride.Core.Quantum;

/// <summary>
/// A base abstract implementation of the <see cref="IGraphNode"/> interface.
/// </summary>
public abstract class GraphNodeBase : IInitializingGraphNode
{
    protected readonly NodeContainer NodeContainer;

    protected GraphNodeBase(NodeContainer nodeContainer, Guid guid, ITypeDescriptor descriptor)
    {
        if (guid == Guid.Empty) throw new ArgumentException("The guid must be different from Guid.Empty.", nameof(guid));
        NodeContainer = nodeContainer;
        Guid = guid;
        Descriptor = descriptor ?? throw new ArgumentNullException(nameof(descriptor));
    }

    /// <inheritdoc/>
    public Type Type => Descriptor.Type;

    /// <inheritdoc/>
    public ITypeDescriptor Descriptor { get; }

    /// <inheritdoc/>
    public abstract bool IsReference { get; }

    /// <inheritdoc/>
    public Guid Guid { get; }

    /// <inheritdoc/>

View on GitHub (pinned to 96fad776d2)