stride3d/stride · error · NotImplementedException

Support of ExternalIdentifiableAsGuid without…

Error message

Support of ExternalIdentifiableAsGuid without ReuseReferences is not implemented yet.

What it means

SerializerSelector is Stride's serialization profile selector. The ExternalIdentifiableAsGuid option (serializing IIdentifiable objects as raw GUIDs instead of inline references) relies on the reference-tracking machinery that only exists when ReuseReferences is enabled, so the constructor rejects the invalid combination at construction time.

Solutions

  1. Enable ReuseReferences whenever ExternalIdentifiableAsGuid is true: new SerializerSelector(true, externalIdentifiableAsGuid, profiles)
  2. Or drop the ExternalIdentifiableAsGuid flag if GUID-only representation is not required
  3. Centralize serializer-settings construction so the two flags are always set together

Example fix

// before
var selector = new SerializerSelector(false, true, "assets");
// after
var selector = new SerializerSelector(true, true, "assets");
Defensive patterns

Strategy: validation

Validate before calling

if (externalIdentifiableAsGuid && !reuseReferences)
    throw new ArgumentException("ExternalIdentifiableAsGuid requires ReuseReferences=true");
var selector = new SerializerSelector(reuseReferences, externalIdentifiableAsGuid, profiles);

Try / catch

try { selector = new SerializerSelector(reuse, asGuid, profiles); }
catch (NotImplementedException e) { /* fix flags: asGuid requires reuse */ }

Prevention

When it happens

Trigger: Calling new SerializerSelector(externalIdentifiableAsGuid: true, reuseReferences: false, ...) — i.e. passing profiles with reuseReferences=false and externalIdentifiableAsGuid=true. The convenience constructor new SerializerSelector(profiles) passes (false,false), so it never triggers this.

Common situations: Hand-building serialization options for asset or content loading (e.g. ContentManagerSerializerSettings) where a developer toggles ExternalIdentifiableAsGuid but forgets that ReuseReferences must be true; copying flags from config where the two booleans are set independently.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


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

Appendix: source

Thrown at sources/core/Stride.Core/Serialization/SerializerSelector.cs:62

        Asset = new SerializerSelector(false, -1, "Default", "Content");
        Asset.Initialize();

        AssetWithReuse = new SerializerSelector(true, -1, "Default", "Content");
        AssetWithReuse.Initialize();
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="SerializerSelector"/> class.
    /// </summary>
    /// <param name="reuseReferences">if set to <c>true</c> reuse references (allow cycles in the object graph).</param>
    /// <param name="profiles">The profiles.</param>
    public SerializerSelector(bool reuseReferences, bool externalIdentifiableAsGuid, params string[] profiles)
    {
        ReuseReferences = reuseReferences;
        ExternalIdentifiableAsGuid = externalIdentifiableAsGuid;
        if (externalIdentifiableAsGuid && !reuseReferences)
            throw new NotImplementedException("Support of ExternalIdentifiableAsGuid without ReuseReferences is not implemented yet.");
        this.profiles = profiles;
        Initialize();
    }

    public SerializerSelector(params string[] profiles) : this(false, false, profiles)
    {
    }

    /// <summary>
    /// Checks if this instance supports the specified serialization profile.
    /// </summary>
    /// <param name="profile">Name of the profile</param>
    /// <returns><c>true</c> if this instance supports the specified serialization profile</returns>
    public bool HasProfile(string profile)
    {
        ArgumentNullException.ThrowIfNull(profile);
        for (var i = 0; i < profiles.Length; i++)
        {

View on GitHub (pinned to 96fad776d2)