stride3d/stride · error · ArgumentException
assetType should inherit from Asset
Error message
assetType should inherit from Asset
What it means
Constructor argument validation for the BuildDependencyInfo struct: the assetType parameter does not inherit from Asset, so it cannot legally describe a build dependency target. The faulting input is the assetType argument.
Solutions
- Pass an Asset-derived type as assetType
- If depending on a non-asset, use the appropriate dependency mechanism instead of BuildDependencyInfo
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at sources/assets/Stride.Core.Assets/Analysis/BuildDependencyInfo.cs:33 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/892308de6cae9d6d.
Report an issue: GitHub.
Appendix: source
Thrown at sources/assets/Stride.Core.Assets/Analysis/BuildDependencyInfo.cs:33
public readonly Type CompilationContext;
/// <summary>
/// The type of asset targeted by this dependency.
/// </summary>
public readonly Type AssetType;
/// <summary>
/// The type of dependency, indicating whether the target asset must actually be compiled, and whether it should be compiled before the referecing asset or can be at the same time.
/// </summary>
public readonly BuildDependencyType DependencyType;
/// <summary>
/// Initializes a new instance of the <see cref="BuildDependencyInfo"/> structure.
/// </summary>
/// <param name="assetType">The type of asset targeted by this dependency info.</param>
/// <param name="compilationContext">The compilation context in which to compile the target asset.</param>
/// <param name="dependencyType">The type of dependency.</param>
public BuildDependencyInfo(Type assetType, Type compilationContext, BuildDependencyType dependencyType)
{
if (!typeof(Asset).IsAssignableFrom(assetType)) throw new ArgumentException($@"{nameof(assetType)} should inherit from Asset", nameof(assetType));
if (!typeof(ICompilationContext).IsAssignableFrom(compilationContext)) throw new ArgumentException($@"{nameof(compilationContext)} should inherit from ICompilationContext", nameof(compilationContext));
AssetType = assetType;
CompilationContext = compilationContext;
DependencyType = dependencyType;
}
/// <inheritdoc/>
public readonly bool Equals(BuildDependencyInfo other)
{
return ReferenceEquals(CompilationContext, other.CompilationContext) && ReferenceEquals(AssetType, other.AssetType) && DependencyType == other.DependencyType;
}
/// <inheritdoc/>
public override readonly bool Equals(object? obj)
{
if (ReferenceEquals(null, obj))
return false;
return obj is BuildDependencyInfo info && Equals(info);View on GitHub (pinned to 96fad776d2)