|
| 1 | +--- |
| 2 | +title: "Breaking change - Activity reporter and pipeline context renamed" |
| 3 | +description: "Learn about the breaking change in Aspire 13.0 where publishing activity reporter APIs and context types were renamed to reflect pipeline architecture." |
| 4 | +ms.date: 10/20/2025 |
| 5 | +ai-usage: ai-assisted |
| 6 | +ms.custom: https://github.com/dotnet/aspire/pull/12137 |
| 7 | +--- |
| 8 | + |
| 9 | +# Activity reporter and pipeline context renamed |
| 10 | + |
| 11 | +In Aspire 13.0, the publishing activity reporter APIs and context types have been renamed to better reflect the pipeline architecture. The publishing step creation process has been simplified, with steps now automatically created during pipeline execution rather than requiring explicit creation within step actions. |
| 12 | + |
| 13 | +## Version introduced |
| 14 | + |
| 15 | +Aspire 13.0 Preview 1 |
| 16 | + |
| 17 | +## Previous behavior |
| 18 | + |
| 19 | +The previous API used publishing-specific names and required explicit step creation within pipeline actions: |
| 20 | + |
| 21 | +```csharp |
| 22 | +builder.Pipeline.AddStep("assign-storage-role", async (context) => |
| 23 | +{ |
| 24 | + var roleAssignmentStep = await context.ActivityReporter |
| 25 | + .CreateStepAsync($"assign-storage-role", context.CancellationToken); |
| 26 | + |
| 27 | + await using (roleAssignmentStep.ConfigureAwait(false)) |
| 28 | + { |
| 29 | + var assignRoleTask = await roleAssignmentStep |
| 30 | + .CreateTaskAsync($"Granting file share access...", context.CancellationToken); |
| 31 | + |
| 32 | + await using (assignRoleTask.ConfigureAwait(false)) |
| 33 | + { |
| 34 | + // ... task work |
| 35 | + } |
| 36 | + } |
| 37 | +}); |
| 38 | +``` |
| 39 | + |
| 40 | +The types used were: |
| 41 | + |
| 42 | +- `DeployingContext` - Provided context for pipeline execution |
| 43 | +- `IPublishingActivityReporter` - Interface for reporting activities |
| 44 | +- `PublishingActivityReporter` - Implementation of the activity reporter |
| 45 | +- `NullPublishingActivityReporter` - Null object pattern implementation |
| 46 | +- `IPublishingStep` - Interface for publishing steps |
| 47 | +- `IPublishingTask` - Interface for publishing tasks |
| 48 | + |
| 49 | +## New behavior |
| 50 | + |
| 51 | +The API now uses pipeline-specific names and automatically creates steps during pipeline execution: |
| 52 | + |
| 53 | +```csharp |
| 54 | +builder.Pipeline.AddStep("assign-storage-role", async (stepContext) => |
| 55 | +{ |
| 56 | + var assignRoleTask = await stepContext.ReportingStep |
| 57 | + .CreateTaskAsync($"Granting file share access...", stepContext.CancellationToken); |
| 58 | + |
| 59 | + await using (assignRoleTask.ConfigureAwait(false)) |
| 60 | + { |
| 61 | + // ... task work |
| 62 | + } |
| 63 | +}); |
| 64 | +``` |
| 65 | + |
| 66 | +The types have been renamed as follows: |
| 67 | + |
| 68 | +- `DeployingContext` → `PipelineContext` - Shared context across all pipeline steps |
| 69 | +- `IPublishingActivityReporter` → `IPipelineActivityReporter` - Interface for reporting pipeline activities |
| 70 | +- `PublishingActivityReporter` → `PipelineActivityReporter` - Implementation of the pipeline activity reporter |
| 71 | +- `NullPublishingActivityReporter` → `NullPipelineActivityReporter` - Null object pattern implementation |
| 72 | +- `IPublishingStep` → `IReportingStep` - Interface for reporting steps |
| 73 | +- `IPublishingTask` → `IReportingTask` - Interface for reporting tasks |
| 74 | + |
| 75 | +Additionally, a new `PipelineStepContext` type has been introduced that combines the shared `PipelineContext` with a step-specific `IReportingStep`, allowing each step to track its own tasks and completion state independently. |
| 76 | + |
| 77 | +## Type of breaking change |
| 78 | + |
| 79 | +This change can affect [binary compatibility](../categories.md#binary-compatibility) and [source compatibility](../categories.md#source-compatibility). |
| 80 | + |
| 81 | +## Reason for change |
| 82 | + |
| 83 | +The previous three-level hierarchy (`ActivityReporter → Step → Task`) was unnecessarily complex. The new architecture simplifies this by automatically creating steps during pipeline execution and integrating step management directly into the pipeline. This provides a cleaner separation between the shared pipeline context and step-specific execution context, making the API more intuitive and reducing boilerplate code. |
| 84 | + |
| 85 | +## Recommended action |
| 86 | + |
| 87 | +Update your code to use the new type names and simplified step creation pattern: |
| 88 | + |
| 89 | +1. Replace `DeployingContext` with `PipelineContext` for shared pipeline context or `PipelineStepContext` for step-specific context. |
| 90 | +1. Replace `IPublishingActivityReporter` with `IPipelineActivityReporter`. |
| 91 | +1. Replace `PublishingActivityReporter` with `PipelineActivityReporter`. |
| 92 | +1. Replace `NullPublishingActivityReporter` with `NullPipelineActivityReporter`. |
| 93 | +1. Replace `IPublishingStep` with `IReportingStep`. |
| 94 | +1. Replace `IPublishingTask` with `IReportingTask`. |
| 95 | +1. Update pipeline step actions to accept `PipelineStepContext` instead of `DeployingContext`. |
| 96 | +1. Remove explicit step creation calls within pipeline actions and use the automatically created `context.ReportingStep` instead. |
| 97 | + |
| 98 | +Migration example: |
| 99 | + |
| 100 | +```csharp |
| 101 | +// Before |
| 102 | +builder.Pipeline.AddStep("my-step", async (context) => |
| 103 | +{ |
| 104 | + var step = await context.ActivityReporter |
| 105 | + .CreateStepAsync("my-step", context.CancellationToken); |
| 106 | + |
| 107 | + await using (step.ConfigureAwait(false)) |
| 108 | + { |
| 109 | + var task = await step.CreateTaskAsync("Doing work...", context.CancellationToken); |
| 110 | + await using (task.ConfigureAwait(false)) |
| 111 | + { |
| 112 | + // Do work |
| 113 | + await task.CompleteAsync("Done", CompletionState.Completed, context.CancellationToken); |
| 114 | + } |
| 115 | + } |
| 116 | +}); |
| 117 | + |
| 118 | +// After |
| 119 | +builder.Pipeline.AddStep("my-step", async (stepContext) => |
| 120 | +{ |
| 121 | + var task = await stepContext.ReportingStep |
| 122 | + .CreateTaskAsync("Doing work...", stepContext.CancellationToken); |
| 123 | + |
| 124 | + await using (task.ConfigureAwait(false)) |
| 125 | + { |
| 126 | + // Do work |
| 127 | + await task.CompleteAsync("Done", CompletionState.Completed, stepContext.CancellationToken); |
| 128 | + } |
| 129 | +}); |
| 130 | +``` |
| 131 | + |
| 132 | +## Affected APIs |
| 133 | + |
| 134 | +- <xref:Aspire.Hosting.ApplicationModel.DeployingContext?displayProperty=fullName> |
| 135 | +- <xref:Aspire.Hosting.Publishing.IPublishingActivityReporter?displayProperty=fullName> |
| 136 | +- `Aspire.Hosting.Publishing.PublishingActivityReporter` |
| 137 | +- <xref:Aspire.Hosting.Publishing.NullPublishingActivityReporter?displayProperty=fullName> |
| 138 | +- <xref:Aspire.Hosting.Publishing.IPublishingStep?displayProperty=fullName> |
| 139 | +- <xref:Aspire.Hosting.Publishing.IPublishingTask?displayProperty=fullName> |
| 140 | +- `Aspire.Hosting.Publishing.PublishingStep` |
| 141 | +- `Aspire.Hosting.Publishing.PublishingTask` |
| 142 | +- <xref:Aspire.Hosting.Publishing.PublishingExtensions?displayProperty=fullName> |
0 commit comments