Skip to content

Make sure there's runtime mapping for delegate Invoke methods #70880

@MichalStrehovsky

Description

@MichalStrehovsky

We have the metadata for the Invoke method, but not a method body mapping.

Likely dataflow didn't compute the delegate as something that would need methods.

Should look into where/how we get the MethodInfo in the first place. Maybe dataflow should have computed that or issued a warning.

We can also just special case in the compiler. Invoke is already special cased to get the metadata.

Cc @davidfowl

[16:57] David Fowler
Connection id "0HMIG6RC1KTOO", Request id "0HMIG6RC1KTOO:00000001": An unhandled exception was thrown by the application.
EETypeRva:0x01623FD0(System.Reflection.MissingRuntimeArtifactException): This object cannot be invoked because no code was generated for it: 'Microsoft.AspNetCore.Http.RouteHandlerFilterDelegate.Invoke(Microsoft.AspNetCore.Http.RouteHandlerInvocationContext)'.
at System.Reflection.Runtime.MethodInfos.RuntimeNamedMethodInfo`1.GetUncachedMethodInvoker(RuntimeTypeInfo[], MemberInfo) + 0x113
at System.Reflection.Runtime.MethodInfos.RuntimeMethodInfo.get_MethodInvoker() + 0xa1
at System.Reflection.Runtime.MethodInfos.RuntimeMethodInfo.Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) + 0x34
at System.Linq.Expressions.Interpreter.MethodInfoCallInstruction.Run(InterpretedFrame) + 0x10d
at System.Linq.Expressions.Interpreter.Interpreter.Run(InterpretedFrame) + 0x2d
at System.Linq.Expressions.Interpreter.LightLambda.Run(Object[]) + 0x80
at System.Linq.Expressions.Interpreter.MethodInfoCallInstruction.Run(InterpretedFrame) + 0xd4
at System.Linq.Expressions.Interpreter.Interpreter.Run(InterpretedFrame) + 0x2d
at System.Linq.Expressions.Interpreter.LightLambda.Run(Object[]) + 0x80
at WebApplication35!<BaseAddress>+0xaf6d79
at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext) + 0x1b1
--- End of stack trace from previous location ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x20
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0xb6
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.<ProcessRequests>d__231`1.MoveNext() + 0x499

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions