SboxSuperuser/Engine/CommandDiscovery/HandlerSignature2.cs

Generic handler signature validator for two-argument command handlers. It checks at discovery time that a Sandbox.MethodDescription can be bound to either a Func<T1, T2, CommandResult> or an async Func<T1, T2, Task<CommandResult>> by creating the closed delegate without invoking it.

Reflection
namespace SboxSuperuser.Engine.CommandDiscovery;

internal sealed class HandlerSignature2<T1, T2> : IHandlerSignature
{
	/// <summary>Checks closed delegate binding without executing the handler.</summary>
	public void Validate( Sandbox.MethodDescription method )
	{
		if ( method.ReturnType == typeof( CommandResult ) )
		{
			_ = method.CreateDelegate<Func<T1, T2, CommandResult>>();
		}
		else
		{
			_ = method.CreateDelegate<Func<T1, T2, Task<CommandResult>>>();
		}
	}
}