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

Durable Activity Functions in nested classes do not get discovered by function.json generator since SDK 1.0.31 #401

Open
ielcoro opened this issue Mar 12, 2020 · 0 comments · May be fixed by #526

Comments

@ielcoro
Copy link

ielcoro commented Mar 12, 2020

This caused us a great headache, because we only could detect it after deploying to Azure. Since 1.0.31 something changed, that when you declare your durable activity functions inside nested classes like this:

public class someFunction
    {
        [FunctionName("someFunction")]
        public async Task<List<string>> RunOrchestrator(
            [OrchestrationTrigger] IDurableOrchestrationContext context)
        {
            var outputs = new List<string>();

            // Replace "hello" with the name of your Durable Activity Function.
            outputs.Add(await context.CallActivityAsync<string>("someFunction_Hello", "Tokyo"));
            outputs.Add(await context.CallActivityAsync<string>("someFunction_Hello", "Seattle"));
            outputs.Add(await context.CallActivityAsync<string>("someFunction_Hello", "London"));

            // returns ["Hello Tokyo!", "Hello Seattle!", "Hello London!"]
            return outputs;
        }

        public class Activities
        {

            [FunctionName("someFunction_Hello")]
            public string SayHello([ActivityTrigger] string name, ILogger log)
            {
                log.LogInformation($"Saying hello to {name}.");
                return $"Hello {name}!";
            }
        }
}

The function.json for the nested function, someFunction_Hello, is totally missing from the ouput since SDK 1.0.31. This is the output of SDK 1.0.31 build:

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        12/03/2020    14:00                bin
d-----        12/03/2020    14:00                someFunction
d-----        12/03/2020    14:00                someFunction_HttpStart
-a----        11/03/2020    22:09            231 host.json
-a----        11/03/2020    22:09            163 local.settings.json
-a----        12/03/2020    14:00          94559 someFunction.deps.json

While SDK 1.0.29 does generate someFunctionHello's function.json, generating a correct output:

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        12/03/2020    14:01                bin
d-----        12/03/2020    14:01                someFunction
d-----        12/03/2020    14:01                someFunction_Hello
d-----        12/03/2020    14:01                someFunction_HttpStart
-a----        11/03/2020    22:09            231 host.json
-a----        11/03/2020    22:09            163 local.settings.json
-a----        12/03/2020    14:01          94552 someFunction.deps.json`

We tried this on SDK versions 1.0.33 and 1.0.34 with the same wrong output. We hope we don't need to change our coding conventions because of this and the team can fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants