RouteAttributeHelper.CreateMatchingHandlerDelegate Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Selects the first handler delegate Type declared on attributeType via
RouteHandlerTypeAttribute whose Invoke signature matches method,
then creates a bound delegate of that type. This lets a single route attribute accept more than one
handler signature (for example ActionExecuteHandler or ActionExecuteInvokeHandler),
resolving the concrete delegate from the decorated method at registration time.
public static Delegate CreateMatchingHandlerDelegate(Microsoft.Agents.Builder.App.AgentApplication app, System.Reflection.MethodInfo method, Type attributeType);
static member CreateMatchingHandlerDelegate : Microsoft.Agents.Builder.App.AgentApplication * System.Reflection.MethodInfo * Type -> Delegate
Public Shared Function CreateMatchingHandlerDelegate (app As AgentApplication, method As MethodInfo, attributeType As Type) As Delegate
Parameters
- app
- AgentApplication
The agent application to bind the delegate to for instance methods.
- method
- MethodInfo
The decorated method to wrap as a delegate.
Returns
A delegate of the matching declared handler type, bound to app for instance methods.
Remarks
Open/unbound generic declared handler types (for example typeof(FetchHandler<>)) are skipped, matching the analyzer behavior; use InvokeGenericWithHandler(AgentApplication, MethodInfo, Type, Int32, Object) for those. When no declared handler matches, an exception is thrown — though the MAA002 analyzer normally surfaces the mismatch at compile time before this code runs.