Skip to content

AotTypeResolver is generated with invalid code for MakeGenericType #2865

@TheRumle

Description

@TheRumle

After updating from 0.25.21 to 0.53.0 I now get the following error: "The non-generic type 'Type' cannot be used with type arguments."
I have tracked down the issue to the generated file AotTypeResolver.g.cs.

    public static Type? MakeGenericType(Type genericTypeDefinition, params Type[] typeArguments)
    {
        if (genericTypeDefinition == null || typeArguments == null || typeArguments.Length == 0)
            return null;
        var cacheKey = (genericTypeDefinition, typeArguments);
        if (_genericTypeCache.TryGetValue(cacheKey, out var cachedGenericType))
            return cachedGenericType;
        // Handle known generic type combinations
        if (genericTypeDefinition == typeof(global::System.Type) && typeArguments.Length == 1)
        {
            if (typeArguments[0] == typeof(global::System.Type))
            {
                var result = typeof(global::System.Type<global::System.Type>);
                _genericTypeCache[cacheKey] = result;
                return result;
            }
        }
        return null;
    }

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions