CreateClient/AddTaskActivitiesFromInterface with non-Task methods
- Dominant language
- C#
- Stars
- 1.7k
- Forks
- 335
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 6
Description
Consider the following interface and implementation:
```
public interface IClient
{
IEnumerable GetUsers();
}
public class Client : IClient
{
public IEnumerable GetUsers()
{
return new[] { "user1", "user2" };
}
}
```
When using AddTaskActivitiesFromInterface like so:
```
taskHub.AddTaskActivitiesFromInterface(new Client());
```
and then creating a client within an orchestration:
```
var client = context.CreateClient();
var users = client.GetUsers();
foreach (var user in users)
{
string greeting = await context.ScheduleTask(typeof(SendGreetingTask), user);
}
```
This will result in an error since the returned value is not an `IEnumerable`. It appears that the actual result is `System.Threading.Tasks.Task`1[System.String]` with an underlying "ActLike_IEnumerable" type.
From the looks of it, the root cause is coming from `ScheduleProxy.TryInvokeMember`, which assumes that the returned type is of type `Task`, but "swallows" a `IEnumerable` in the same way.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.