@@ -56,7 +56,7 @@ public static partial class RequestDelegateFactory
56
56
private static readonly MethodInfo ValueTaskOfTToValueTaskOfObjectMethod = typeof ( RequestDelegateFactory ) . GetMethod ( nameof ( ValueTaskOfTToValueTaskOfObject ) , BindingFlags . NonPublic | BindingFlags . Static ) ! ;
57
57
private static readonly MethodInfo PopulateMetadataForParameterMethod = typeof ( RequestDelegateFactory ) . GetMethod ( nameof ( PopulateMetadataForParameter ) , BindingFlags . NonPublic | BindingFlags . Static ) ! ;
58
58
private static readonly MethodInfo PopulateMetadataForEndpointMethod = typeof ( RequestDelegateFactory ) . GetMethod ( nameof ( PopulateMetadataForEndpoint ) , BindingFlags . NonPublic | BindingFlags . Static ) ! ;
59
- private static readonly MethodInfo ArrayEmptyMethod = typeof ( Array ) . GetMethod ( nameof ( Array . Empty ) , BindingFlags . Public | BindingFlags . Static ) ! ;
59
+ private static readonly MethodInfo ArrayEmptyOfObjectMethod = typeof ( Array ) . GetMethod ( nameof ( Array . Empty ) , BindingFlags . Public | BindingFlags . Static ) ! . MakeGenericMethod ( new Type [ ] { typeof ( object ) } ) ;
60
60
61
61
// Call WriteAsJsonAsync<object?>() to serialize the runtime return type rather than the declared return type.
62
62
// https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-polymorphism
@@ -391,7 +391,7 @@ private static Expression CreateRouteHandlerInvocationContextBase(FactoryContext
391
391
// non-generic implementation of RouteHandlerInvocationContext.
392
392
Expression paramArray = factoryContext . BoxedArgs . Length > 0
393
393
? Expression . NewArrayInit ( typeof ( object ) , factoryContext . BoxedArgs )
394
- : Expression . Call ( ArrayEmptyMethod . MakeGenericMethod ( new Type [ ] { typeof ( object ) } ) ) ;
394
+ : Expression . Call ( ArrayEmptyOfObjectMethod ) ;
395
395
var fallbackConstruction = Expression . New (
396
396
DefaultRouteHandlerInvocationContextConstructor ,
397
397
new Expression [ ] { HttpContextExpr , paramArray } ) ;
0 commit comments