stride3d/stride · error · InvalidOperationException

The type does not have a public parameterless constructor.)

Error message

The type {type.Name} does not have a public parameterless constructor.)

What it means

Registration-time validation in AssetQuantumRegistry.RegisterAssembly for graph-definition types: a type marked with AssetPropertyGraphDefinitionAttribute does not expose a public parameterless constructor, which the registry requires to instantiate the definition on demand.

Solutions

  1. Add a public parameterless constructor to the graph definition class
  2. Remove constructor parameters/dependencies that prevent a default instantiation
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at sources/assets/Stride.Core.Assets.Quantum/AssetQuantumRegistry.cs:68 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/daa804d3508c2512. Report an issue: GitHub.

Appendix: source

Thrown at sources/assets/Stride.Core.Assets.Quantum/AssetQuantumRegistry.cs:68

                if (type.GetConstructor(AssetPropertyNodeGraphConstructorSignature) is null)
                    throw new InvalidOperationException($"The type {type.Name} does not have a public constructor matching the expected signature: ({string.Join(", ", (IEnumerable<Type>)AssetPropertyNodeGraphConstructorSignature)})");

                if (!NodeGraphTypes.TryAdd(attribute.AssetType, type))
                    throw new ArgumentException($"The type {attribute.AssetType.Name} already has an associated property node graph type.");
            }
        }

        if (scanTypes.Types.TryGetValue(typeof(AssetPropertyGraphDefinitionAttribute), out var definitionTypes))
        {
            foreach (var type in definitionTypes)
            {
                var attribute = type.GetCustomAttribute<AssetPropertyGraphDefinitionAttribute>();
                if (attribute is null)
                    continue;

                if (type.GetConstructor(Type.EmptyTypes) is null)
                    throw new InvalidOperationException($"The type {type.Name} does not have a public parameterless constructor.)");

                if (NodeGraphDefinitions.ContainsKey(attribute.AssetType))
                    throw new ArgumentException($"The type {attribute.AssetType.Name} already has an associated property node graph type.");

                if (attribute.AssetType.IsGenericTypeDefinition && type.IsGenericType)
                {
                    // If the asset type is generic (usually a base class of other asset types), we cannot create instances yet.
                    // So we just store the generic type definition in another dictionary.
                    GenericNodeGraphDefinitionTypes.Add(attribute.AssetType, type.GetGenericTypeDefinition());
                }
                else
                {
                    // Normal case, we create an instance of the definition immediately.
                    var definition = (AssetPropertyGraphDefinition)Activator.CreateInstance(type)!;
                    NodeGraphDefinitions.Add(attribute.AssetType, definition);
                }
            }
        }

View on GitHub (pinned to 96fad776d2)