stride3d/stride · error · ArgumentException

The given type must be assignable to the

Error message

The given type must be assignable to the {nameof(Asset)} type.

What it means

Constructor guard on AssetPropertyGraphAttribute: the assetType argument is not a subclass of Stride.Core.Assets.Asset, so it cannot be registered as the target type of a property node graph. The faulting input is the assetType parameter passed to the attribute.

Solutions

  1. Pass a type that derives from Asset (or Asset itself) to the attribute constructor
  2. If the target is a plain data class, do not mark it with AssetPropertyGraphAttribute
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at sources/assets/Stride.Core.Assets.Quantum/AssetPropertyGraphAttribute.cs:17 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at sources/assets/Stride.Core.Assets.Quantum/AssetPropertyGraphAttribute.cs:17

// 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 Stride.Core.Annotations;
using Stride.Core.Reflection;

namespace Stride.Core.Assets.Quantum;

[AttributeUsage(AttributeTargets.Class, Inherited = false)]
[BaseTypeRequired(typeof(AssetPropertyGraph))]
[AssemblyScan]
public class AssetPropertyGraphAttribute : Attribute
{
    public AssetPropertyGraphAttribute(Type assetType)
    {
        ArgumentNullException.ThrowIfNull(assetType);
        if (!typeof(Asset).IsAssignableFrom(assetType)) throw new ArgumentException($"The given type must be assignable to the {nameof(Asset)} type.");
        AssetType = assetType;
    }

    public Type AssetType { get; }
}

View on GitHub (pinned to 96fad776d2)