temporalio / sdk-dotnet

Temporal .NET SDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Request] Activity delegates can sometimes have System.Runtime.CompilerServices.Closure first param

cretz opened this issue · comments

Describe the solution you'd like

If you use expression trees to create a lambda, the first param of defn.Delegate.Method.GetParameters() is a System.Runtime.CompilerServices.Closure. We should not be using that to determine the first parameter. Rather, we should either use defn.Delegate.GetType().GetMethod("Invoke"). Or maybe even better, we should add object? Invoke(params object?[]? parameters), ReturnType and ParameterTypes to ActivityDefinition, and have an alternative constructor like CreateWithoutAttribute(string name, Type returnType, Type[] parameterTypes, InvokeFunc call) (where delegate object? InvokeFunc(params object?[] parms) exists).

This is no longer necessary with #67