Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent generic type argument constraints in StartNewAsync<T> #1814

Open
shibayan opened this issue May 3, 2021 · 0 comments · May be fixed by #2413
Open

Inconsistent generic type argument constraints in StartNewAsync<T> #1814

shibayan opened this issue May 3, 2021 · 0 comments · May be fixed by #2413
Labels

Comments

@shibayan
Copy link
Contributor

shibayan commented May 3, 2021

Description

Inconsistent type argument constraints in the StartNewAsync<T> method, resulting in compilation errors depending on the method overload actually used.

The method with two arguments has a class constraint, but the one with three arguments does not. As a result, the method with two arguments causes an error if the tuple type is used.

Task<string> StartNewAsync<T>(
string orchestratorFunctionName,
T input)
where T : class;

Task<string> StartNewAsync<T>(string orchestratorFunctionName, string instanceId, T input);

The generic type argument for StartNewAsync<T> may not be necessary. There is no generic method for sub-orchestrators, so it is inconsistent to have a generic method only for StartNewAsync<T>.

Expected behavior

Can be compiled successfully with Tuple.

Actual behavior

A compile error occurs.

Relevant source code snippets

// error CS7036: There is no argument given that corresponds to the required formal parameter 'input' of 'IDurableOrchestrationClient.StartNewAsync<T>(string, string, T)
string instanceId = await starter.StartNewAsync("Function1", ("test", 1, 2, 3));

Known workarounds

// 1. Specify the type argument explicitly
string instanceId = await starter.StartNewAsync<object>("Function1", ("test", 1, 2, 3));

// 2. Use an overload method with three arguments
string instanceId = await starter.StartNewAsync("Function1", null, ("test", 1, 2, 3));

App Details

  • Durable Functions extension version (e.g. v1.8.3): 2.4.3
  • Azure Functions runtime version (1.0 or 2.0): 3.0
  • Programming language used: C#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants