-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
36 lines (31 loc) · 1.17 KB
/
Program.cs
File metadata and controls
36 lines (31 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Minimal repro for DurableTask.Analyzers ArgumentNullException('node') bug.
//
// The analyzer (v0.2.0) crashes when AddOrchestratorFunc is called with an
// inline lambda inside a foreach loop that captures a loop-scoped variable.
//
// The analyzer is pulled transitively via:
// Microsoft.Azure.Functions.Worker.Extensions.DurableTask 1.13.1
// -> Microsoft.DurableTask.Analyzers 0.2.0
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Builder;
using Microsoft.DurableTask;
using Microsoft.DurableTask.Worker;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
var builder = FunctionsApplication.CreateBuilder(args);
string[] names = ["A", "B"];
builder.ConfigureDurableWorker().AddTasks(tasks =>
{
foreach (string name in names)
{
tasks.AddOrchestratorFunc<string, string>(
name,
async (ctx, input) =>
{
ILogger logger = ctx.CreateReplaySafeLogger(name);
return await ctx.CallActivityAsync<string>("Activity", input);
});
}
});
builder.Build().Run();