stride3d/stride · error · NotSupportedException

can only handle Value and Object keys

Error message

{nameof(ParameterCollectionResolver)} can only handle Value and Object keys

What it means

ParameterCollectionResolver.ResolveIndexer supports only ParameterKeyType.Value and ParameterKeyType.Object; any other key type hits the default branch and throws NotSupportedException. This is an explicit capability boundary of the resolver, not a data problem.

Solutions

  1. Use a supported Value or Object ParameterKey for the property path.
  2. If you own the key, change its registration so it is a Value or Object key.
  3. Handle/avoid the key type in custom resolver code by extending ResolveIndexer with your own accessor.

Example fix

// before
// path targets key with unsupported ParameterKeyType
// after
var key = ParameterKeys.New<float>("MyKeys.Threshold"); // Value key, supported
Defensive patterns

Strategy: try-catch

Validate before calling

var key = ParameterKeys.FindByName(keyName);
if (key != null && key.Type != ParameterKeyType.Value && key.Type != ParameterKeyType.Object)
    Log.Warning($"Key '{keyName}' type {key.Type} unsupported by ParameterCollectionResolver.");

Try / catch

try { resolver.ResolveIndexer(keyName); }
catch (NotSupportedException) { Log.Error($"Key '{keyName}' is not a Value/Object key; use a supported key or a custom resolver."); }

Prevention

When it happens

Trigger: Resolving a property path whose ParameterKey has a type other than Value or Object (e.g. a key kind introduced for internal/performance categories) through this resolver.

Common situations: Pointing editor property paths at internal parameter keys never meant for this resolver, or framework upgrades adding new key types that older resolver code paths do not handle.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at sources/engine/Stride.Engine/Engine/Design/ParameterCollectionResolver.cs:39

        public override Type SupportedType => typeof(ParameterCollection);

        [UnconditionalSuppressMessage("Trimming", "IL2076", Justification = "Accessor instantiations rooted by UpdateEngineProcessor (InstantiateValueAccessor<KeyType>).")]
        [UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Accessor instantiation rooted by UpdateEngineProcessor (InstantiateValueAccessor<KeyType>).")]
        public override UpdatableMember ResolveIndexer(string indexerName)
        {
            var key = ParameterKeys.FindByName(indexerName);
            if (key == null)
                throw new InvalidOperationException($"Property Key path parse error: could not parse indexer value '{indexerName}'");

            switch (key.Type)
            {
                case ParameterKeyType.Value:
                    var accessorType = typeof(ValueParameterCollectionAccessor<>).MakeGenericType(key.PropertyType);
                    return (UpdatableMember)Activator.CreateInstance(accessorType, key);
                case ParameterKeyType.Object:
                    return new ObjectParameterCollectionAccessor(key);
                default:
                    throw new NotSupportedException($"{nameof(ParameterCollectionResolver)} can only handle Value and Object keys");
            }
        }

        // Needed for AOT platforms
        public static void InstantiateValueAccessor<T>() where T : struct
        {
            new ValueParameterCollectionAccessor<T>(null);
        }

        private class ValueParameterCollectionAccessor<T> : UpdatableCustomAccessor where T : struct
        {
            private readonly ValueParameterKey<T> parameterKey;

            public ValueParameterCollectionAccessor(ValueParameterKey<T> parameterKey)
            {
                this.parameterKey = parameterKey;
            }

View on GitHub (pinned to 96fad776d2)