Skip to content

Commit c4879d1

Browse files
authored
Merge branch 'main' into copilot/fix-extension-method-namespace
2 parents 7081018 + 023f0ac commit c4879d1

File tree

5 files changed

+96
-13
lines changed

5 files changed

+96
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ To get started, add the [Microsoft.Azure.Functions.Worker.Extensions.DurableTask
3535
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.DurableTask" Version="1.2.2" />
3636
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.0.13" />
3737
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.7.0" OutputItemType="Analyzer" />
38-
<PackageReference Include="Microsoft.DurableTask.Generators" Version="1.0.0-preview.1" OutputItemType="Analyzer" />
38+
<PackageReference Include="Microsoft.DurableTask.Generators" Version="1.0.0" OutputItemType="Analyzer" />
3939
</ItemGroup>
4040
```
4141

src/Generators/DurableTaskSourceGenerator.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,9 @@ static void AddOrchestratorCallMethod(StringBuilder sourceBuilder, DurableTaskTy
454454
}
455455

456456
sourceBuilder.AppendLine($@"
457+
/// <summary>
458+
/// Schedules a new instance of the <see cref=""{orchestrator.TypeName}""/> orchestrator.
459+
/// </summary>
457460
/// <inheritdoc cref=""IOrchestrationSubmitter.ScheduleNewOrchestrationInstanceAsync""/>
458461
public static Task<string> ScheduleNew{orchestrator.TaskName}InstanceAsync(
459462
this IOrchestrationSubmitter client, {inputParameter}, StartOrchestrationOptions? options = null)
@@ -473,6 +476,9 @@ static void AddSubOrchestratorCallMethod(StringBuilder sourceBuilder, DurableTas
473476
}
474477

475478
sourceBuilder.AppendLine($@"
479+
/// <summary>
480+
/// Calls the <see cref=""{orchestrator.TypeName}""/> sub-orchestrator.
481+
/// </summary>
476482
/// <inheritdoc cref=""TaskOrchestrationContext.CallSubOrchestratorAsync(TaskName, object?, TaskOptions?)""/>
477483
public static Task<{outputType}> Call{orchestrator.TaskName}Async(
478484
this TaskOrchestrationContext context, {inputParameter}, TaskOptions? options = null)
@@ -492,7 +498,11 @@ static void AddActivityCallMethod(StringBuilder sourceBuilder, DurableTaskTypeIn
492498
}
493499

494500
sourceBuilder.AppendLine($@"
495-
public static Task<{outputType}> Call{activity.TaskName}Async(this TaskOrchestrationContext ctx, {inputParameter}, TaskOptions? options = null)
501+
/// <summary>
502+
/// Calls the <see cref=""{activity.TypeName}""/> activity.
503+
/// </summary>
504+
/// <inheritdoc cref=""TaskOrchestrationContext.CallActivityAsync(TaskName, object?, TaskOptions?)""/>
505+
public static Task<{activity.OutputType}> Call{activity.TaskName}Async(this TaskOrchestrationContext ctx, {activity.InputParameter}, TaskOptions? options = null)
496506
{{
497507
return ctx.CallActivityAsync<{outputType}>(""{activity.TaskName}"", input, options);
498508
}}");
@@ -501,6 +511,10 @@ static void AddActivityCallMethod(StringBuilder sourceBuilder, DurableTaskTypeIn
501511
static void AddActivityCallMethod(StringBuilder sourceBuilder, DurableFunction activity)
502512
{
503513
sourceBuilder.AppendLine($@"
514+
/// <summary>
515+
/// Calls the <see cref=""{activity.FullTypeName}""/> activity.
516+
/// </summary>
517+
/// <inheritdoc cref=""TaskOrchestrationContext.CallActivityAsync(TaskName, object?, TaskOptions?)""/>
504518
public static Task<{activity.ReturnType}> Call{activity.Name}Async(this TaskOrchestrationContext ctx, {activity.Parameter}, TaskOptions? options = null)
505519
{{
506520
return ctx.CallActivityAsync<{activity.ReturnType}>(""{activity.Name}"", {activity.Parameter.Name}, options);

src/Generators/Generators.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
<PropertyGroup>
2222
<!-- This file intentionally versions separately from the other packages. -->
2323
<VersionPrefix>1.0.0</VersionPrefix>
24-
<VersionSuffix>preview.1</VersionSuffix>
2524
</PropertyGroup>
2625

2726
<ItemGroup>

test/Generators.Tests/AzureFunctionsTests.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ public class Calculator
2727
string expectedOutput = TestHelpers.WrapAndFormat(
2828
GeneratedClassName,
2929
methodList: @"
30+
/// <summary>
31+
/// Calls the <see cref=""Calculator.Identity""/> activity.
32+
/// </summary>
33+
/// <inheritdoc cref=""TaskOrchestrationContext.CallActivityAsync(TaskName, object?, TaskOptions?)""/>
3034
public static Task<int> CallIdentityAsync(this TaskOrchestrationContext ctx, int input, TaskOptions? options = null)
3135
{
3236
return ctx.CallActivityAsync<int>(""Identity"", input, options);
@@ -57,6 +61,10 @@ public class Calculator
5761
string expectedOutput = TestHelpers.WrapAndFormat(
5862
GeneratedClassName,
5963
methodList: @"
64+
/// <summary>
65+
/// Calls the <see cref=""Calculator.IdentityAsync""/> activity.
66+
/// </summary>
67+
/// <inheritdoc cref=""TaskOrchestrationContext.CallActivityAsync(TaskName, object?, TaskOptions?)""/>
6068
public static Task<int> CallIdentityAsync(this TaskOrchestrationContext ctx, int input, TaskOptions? options = null)
6169
{
6270
return ctx.CallActivityAsync<int>(""Identity"", input, options);
@@ -92,6 +100,10 @@ public class Calculator
92100
string expectedOutput = TestHelpers.WrapAndFormat(
93101
GeneratedClassName,
94102
methodList: @"
103+
/// <summary>
104+
/// Calls the <see cref=""AzureFunctionsTests.Calculator.Identity""/> activity.
105+
/// </summary>
106+
/// <inheritdoc cref=""TaskOrchestrationContext.CallActivityAsync(TaskName, object?, TaskOptions?)""/>
95107
public static Task<AzureFunctionsTests.Input> CallIdentityAsync(this TaskOrchestrationContext ctx, AzureFunctionsTests.Input input, TaskOptions? options = null)
96108
{
97109
return ctx.CallActivityAsync<AzureFunctionsTests.Input>(""Identity"", input, options);
@@ -141,6 +153,10 @@ public class MyActivity : TaskActivity<{inputType}, {outputType}>
141153
string expectedOutput = TestHelpers.WrapAndFormat(
142154
GeneratedClassName,
143155
methodList: $@"
156+
/// <summary>
157+
/// Calls the <see cref=""MyActivity""/> activity.
158+
/// </summary>
159+
/// <inheritdoc cref=""TaskOrchestrationContext.CallActivityAsync(TaskName, object?, TaskOptions?)""/>
144160
public static Task<{outputType}> CallMyActivityAsync(this TaskOrchestrationContext ctx, {inputType} input, TaskOptions? options = null)
145161
{{
146162
return ctx.CallActivityAsync<{outputType}>(""MyActivity"", input, options);
@@ -214,13 +230,19 @@ public class MyOrchestrator : TaskOrchestrator<{inputType}, {outputType}>
214230
.ContinueWith(t => ({outputType})(t.Result ?? default({outputType})!), TaskContinuationOptions.ExecuteSynchronously);
215231
}}
216232
233+
/// <summary>
234+
/// Schedules a new instance of the <see cref=""MyNS.MyOrchestrator""/> orchestrator.
235+
/// </summary>
217236
/// <inheritdoc cref=""IOrchestrationSubmitter.ScheduleNewOrchestrationInstanceAsync""/>
218237
public static Task<string> ScheduleNewMyOrchestratorInstanceAsync(
219238
this IOrchestrationSubmitter client, {expectedInputParameter}, StartOrchestrationOptions? options = null)
220239
{{
221240
return client.ScheduleNewOrchestrationInstanceAsync(""MyOrchestrator"", input, options);
222241
}}
223242
243+
/// <summary>
244+
/// Calls the <see cref=""MyNS.MyOrchestrator""/> sub-orchestrator.
245+
/// </summary>
224246
/// <inheritdoc cref=""TaskOrchestrationContext.CallSubOrchestratorAsync(TaskName, object?, TaskOptions?)""/>
225247
public static Task<{outputType}> CallMyOrchestratorAsync(
226248
this TaskOrchestrationContext context, {expectedInputParameter}, TaskOptions? options = null)
@@ -292,13 +314,19 @@ public abstract class MyOrchestratorBase : TaskOrchestrator<{inputType}, {output
292314
.ContinueWith(t => ({outputType})(t.Result ?? default({outputType})!), TaskContinuationOptions.ExecuteSynchronously);
293315
}}
294316
317+
/// <summary>
318+
/// Schedules a new instance of the <see cref=""MyNS.MyOrchestrator""/> orchestrator.
319+
/// </summary>
295320
/// <inheritdoc cref=""IOrchestrationSubmitter.ScheduleNewOrchestrationInstanceAsync""/>
296321
public static Task<string> ScheduleNewMyOrchestratorInstanceAsync(
297322
this IOrchestrationSubmitter client, {expectedInputParameter}, StartOrchestrationOptions? options = null)
298323
{{
299324
return client.ScheduleNewOrchestrationInstanceAsync(""MyOrchestrator"", input, options);
300325
}}
301326
327+
/// <summary>
328+
/// Calls the <see cref=""MyNS.MyOrchestrator""/> sub-orchestrator.
329+
/// </summary>
302330
/// <inheritdoc cref=""TaskOrchestrationContext.CallSubOrchestratorAsync(TaskName, object?, TaskOptions?)""/>
303331
public static Task<{outputType}> CallMyOrchestratorAsync(
304332
this TaskOrchestrationContext context, {expectedInputParameter}, TaskOptions? options = null)
@@ -498,20 +526,30 @@ public static Task<string> MyOrchestrator([OrchestrationTrigger] TaskOrchestrati
498526
.ContinueWith(t => (string)(t.Result ?? default(string)!), TaskContinuationOptions.ExecuteSynchronously);
499527
}}
500528
529+
/// <summary>
530+
/// Schedules a new instance of the <see cref=""MyNS.MyOrchestrator""/> orchestrator.
531+
/// </summary>
501532
/// <inheritdoc cref=""IOrchestrationSubmitter.ScheduleNewOrchestrationInstanceAsync""/>
502533
public static Task<string> ScheduleNewMyOrchestratorInstanceAsync(
503534
this IOrchestrationSubmitter client, int input, StartOrchestrationOptions? options = null)
504535
{{
505536
return client.ScheduleNewOrchestrationInstanceAsync(""MyOrchestrator"", input, options);
506537
}}
507538
539+
/// <summary>
540+
/// Calls the <see cref=""MyNS.MyOrchestrator""/> sub-orchestrator.
541+
/// </summary>
508542
/// <inheritdoc cref=""TaskOrchestrationContext.CallSubOrchestratorAsync(TaskName, object?, TaskOptions?)""/>
509543
public static Task<string> CallMyOrchestratorAsync(
510544
this TaskOrchestrationContext context, int input, TaskOptions? options = null)
511545
{{
512546
return context.CallSubOrchestratorAsync<string>(""MyOrchestrator"", input, options);
513547
}}
514548
549+
/// <summary>
550+
/// Calls the <see cref=""MyNS.MyActivity""/> activity.
551+
/// </summary>
552+
/// <inheritdoc cref=""TaskOrchestrationContext.CallActivityAsync(TaskName, object?, TaskOptions?)""/>
515553
public static Task<string> CallMyActivityAsync(this TaskOrchestrationContext ctx, int input, TaskOptions? options = null)
516554
{{
517555
return ctx.CallActivityAsync<string>(""MyActivity"", input, options);

test/Generators.Tests/ClassBasedSyntaxTests.cs

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,19 @@ class MyOrchestrator : TaskOrchestrator<{type}, string>
3131
string expectedOutput = TestHelpers.WrapAndFormat(
3232
GeneratedClassName,
3333
methodList: $@"
34+
/// <summary>
35+
/// Schedules a new instance of the <see cref=""MyOrchestrator""/> orchestrator.
36+
/// </summary>
3437
/// <inheritdoc cref=""IOrchestrationSubmitter.ScheduleNewOrchestrationInstanceAsync""/>
3538
public static Task<string> ScheduleNewMyOrchestratorInstanceAsync(
3639
this IOrchestrationSubmitter client, {input}, StartOrchestrationOptions? options = null)
3740
{{
3841
return client.ScheduleNewOrchestrationInstanceAsync(""MyOrchestrator"", input, options);
3942
}}
4043
44+
/// <summary>
45+
/// Calls the <see cref=""MyOrchestrator""/> sub-orchestrator.
46+
/// </summary>
4147
/// <inheritdoc cref=""TaskOrchestrationContext.CallSubOrchestratorAsync(TaskName, object?, TaskOptions?)""/>
4248
public static Task<string> CallMyOrchestratorAsync(
4349
this TaskOrchestrationContext context, {input}, TaskOptions? options = null)
@@ -80,13 +86,19 @@ abstract class MyOrchestratorBase : TaskOrchestrator<int, string>
8086
string expectedOutput = TestHelpers.WrapAndFormat(
8187
GeneratedClassName,
8288
methodList: @"
89+
/// <summary>
90+
/// Schedules a new instance of the <see cref=""MyOrchestrator""/> orchestrator.
91+
/// </summary>
8392
/// <inheritdoc cref=""IOrchestrationSubmitter.ScheduleNewOrchestrationInstanceAsync""/>
8493
public static Task<string> ScheduleNewMyOrchestratorInstanceAsync(
8594
this IOrchestrationSubmitter client, int input, StartOrchestrationOptions? options = null)
8695
{
8796
return client.ScheduleNewOrchestrationInstanceAsync(""MyOrchestrator"", input, options);
8897
}
8998
99+
/// <summary>
100+
/// Calls the <see cref=""MyOrchestrator""/> sub-orchestrator.
101+
/// </summary>
90102
/// <inheritdoc cref=""TaskOrchestrationContext.CallSubOrchestratorAsync(TaskName, object?, TaskOptions?)""/>
91103
public static Task<string> CallMyOrchestratorAsync(
92104
this TaskOrchestrationContext context, int input, TaskOptions? options = null)
@@ -129,6 +141,10 @@ class MyActivity : TaskActivity<{type}, string>
129141
string expectedOutput = TestHelpers.WrapAndFormat(
130142
GeneratedClassName,
131143
methodList: $@"
144+
/// <summary>
145+
/// Calls the <see cref=""MyActivity""/> activity.
146+
/// </summary>
147+
/// <inheritdoc cref=""TaskOrchestrationContext.CallActivityAsync(TaskName, object?, TaskOptions?)""/>
132148
public static Task<string> CallMyActivityAsync(this TaskOrchestrationContext ctx, {input}, TaskOptions? options = null)
133149
{{
134150
return ctx.CallActivityAsync<string>(""MyActivity"", input, options);
@@ -169,6 +185,10 @@ public class MyClass { }
169185
string expectedOutput = TestHelpers.WrapAndFormat(
170186
generatedClassName: "GeneratedDurableTaskExtensions",
171187
methodList: @"
188+
/// <summary>
189+
/// Calls the <see cref=""MyActivity""/> activity.
190+
/// </summary>
191+
/// <inheritdoc cref=""TaskOrchestrationContext.CallActivityAsync(TaskName, object?, TaskOptions?)""/>
172192
public static Task<MyNS.MyClass> CallMyActivityAsync(this TaskOrchestrationContext ctx, MyNS.MyClass input, TaskOptions? options = null)
173193
{
174194
return ctx.CallActivityAsync<MyNS.MyClass>(""MyActivity"", input, options);
@@ -208,16 +228,14 @@ class MyActivityImpl : TaskActivity<MyClass, MyClass>
208228
public class MyClass { }
209229
}";
210230

211-
string expectedOutput = @"
212-
// <auto-generated/>
213-
#nullable enable
214-
215-
using System;
216-
using System.Threading.Tasks;
217-
using Microsoft.DurableTask;
218-
using Microsoft.DurableTask.Internal;
219-
220-
namespace MyNS
231+
string expectedOutput = TestHelpers.WrapAndFormat(
232+
GeneratedClassName,
233+
methodList: @"
234+
/// <summary>
235+
/// Calls the <see cref=""MyNS.MyActivityImpl""/> activity.
236+
/// </summary>
237+
/// <inheritdoc cref=""TaskOrchestrationContext.CallActivityAsync(TaskName, object?, TaskOptions?)""/>
238+
public static Task<MyNS.MyClass> CallMyActivityAsync(this TaskOrchestrationContext ctx, MyNS.MyClass input, TaskOptions? options = null)
221239
{
222240
public static class GeneratedDurableTaskExtensions
223241
{
@@ -271,6 +289,10 @@ abstract class MyActivityBase : TaskActivity<int, string>
271289
string expectedOutput = TestHelpers.WrapAndFormat(
272290
GeneratedClassName,
273291
methodList: @"
292+
/// <summary>
293+
/// Calls the <see cref=""MyActivity""/> activity.
294+
/// </summary>
295+
/// <inheritdoc cref=""TaskOrchestrationContext.CallActivityAsync(TaskName, object?, TaskOptions?)""/>
274296
public static Task<string> CallMyActivityAsync(this TaskOrchestrationContext ctx, int input, TaskOptions? options = null)
275297
{
276298
return ctx.CallActivityAsync<string>(""MyActivity"", input, options);
@@ -461,20 +483,30 @@ class MyEntity : TaskEntity<int>
461483
string expectedOutput = TestHelpers.WrapAndFormat(
462484
GeneratedClassName,
463485
methodList: @"
486+
/// <summary>
487+
/// Schedules a new instance of the <see cref=""MyOrchestrator""/> orchestrator.
488+
/// </summary>
464489
/// <inheritdoc cref=""IOrchestrationSubmitter.ScheduleNewOrchestrationInstanceAsync""/>
465490
public static Task<string> ScheduleNewMyOrchestratorInstanceAsync(
466491
this IOrchestrationSubmitter client, int input, StartOrchestrationOptions? options = null)
467492
{
468493
return client.ScheduleNewOrchestrationInstanceAsync(""MyOrchestrator"", input, options);
469494
}
470495
496+
/// <summary>
497+
/// Calls the <see cref=""MyOrchestrator""/> sub-orchestrator.
498+
/// </summary>
471499
/// <inheritdoc cref=""TaskOrchestrationContext.CallSubOrchestratorAsync(TaskName, object?, TaskOptions?)""/>
472500
public static Task<string> CallMyOrchestratorAsync(
473501
this TaskOrchestrationContext context, int input, TaskOptions? options = null)
474502
{
475503
return context.CallSubOrchestratorAsync<string>(""MyOrchestrator"", input, options);
476504
}
477505
506+
/// <summary>
507+
/// Calls the <see cref=""MyActivity""/> activity.
508+
/// </summary>
509+
/// <inheritdoc cref=""TaskOrchestrationContext.CallActivityAsync(TaskName, object?, TaskOptions?)""/>
478510
public static Task<string> CallMyActivityAsync(this TaskOrchestrationContext ctx, int input, TaskOptions? options = null)
479511
{
480512
return ctx.CallActivityAsync<string>(""MyActivity"", input, options);

0 commit comments

Comments
 (0)