Skip to content

Commit a356142

Browse files
committed
only register if any tasks to register
1 parent 6897cce commit a356142

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/Generators/DurableTaskSourceGenerator.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,11 +358,15 @@ public static class GeneratedDurableTaskExtensions
358358
else
359359
{
360360
// ASP.NET Core-specific service registration methods
361-
AddRegistrationMethodForAllTasks(
362-
sourceBuilder,
363-
orchestrators,
364-
activities,
365-
entities);
361+
// Only generate if there are actually tasks to register
362+
if (orchestrators.Count > 0 || activities.Count > 0 || entities.Count > 0)
363+
{
364+
AddRegistrationMethodForAllTasks(
365+
sourceBuilder,
366+
orchestrators,
367+
activities,
368+
entities);
369+
}
366370
}
367371

368372
sourceBuilder.AppendLine(" }").AppendLine("}");

0 commit comments

Comments
 (0)