Skip to main content

Exceptions and extension points

Exceptions​

Renamed and removed​

V3 typeV4 replacement
PipelineCancelledExceptionPipelineCanceledException
ModuleReferencingSelfExceptionModuleSelfDependencyException
FailedRequirementsExceptionRequirementNotMetException
HttpResponseExceptionPipelineHttpResponseException
SubModuleFailedExceptionCatch the original sub-module exception
AlwaysRunPostponedExceptionRemoved

Review your catch blocks​

Several exceptions changed type or base class:

SituationV4 exception
Pipeline canceledPipelineCanceledException now derives from OperationCanceledException. catch (PipelineException) no longer catches it. Catch OperationCanceledException for ordinary cancellation
Non-success HTTP responsePipelineHttpResponseException derives from HttpRequestException, so it is not a PipelineException either. Its inherited StatusCode is nullable
Missing executableToolNotFoundException, which is a CommandException
Validation errorsTheir own types, such as CommandOptionsValidationException and PipelineValidationException
No modules registeredPipelineException

CommandException​

CommandException now carries the failed command's CommandResult in its Result property. The old members move there:

V3V4
exception.ExitCodeexception.Result.ExitCode
exception.StandardOutput / StandardErrorexception.Result.StandardOutput / Result.StandardError
exception.ExecutionTimeexception.Result.Duration
  • The exception message no longer includes the captured output. Read it from Result.
  • Construct custom command exceptions with a CommandResult. The individual output and exit-code constructor parameters are removed.
try
{
await context.Shell.RunAsync("tool", ["argument"], cancellationToken: cancellationToken);
}
catch (CommandException exception)
{
context.Logger.LogError("Exit code: {ExitCode}; stderr: {Error}",
exception.Result.ExitCode, exception.Result.StandardError);
throw;
}

When a nonzero exit code is expected data, set CommandExecutionOptions.ThrowOnNonZeroExitCode = false and inspect the returned ExitCode.

Extension points​

The rest of this page is for code that extends the framework: custom repositories, validators, attributes, and anything that reached into engine types.

Engine internals are closed​

Engine execution state, schedulers, awaiter completion, and configuration internals are no longer general-purpose public extension points. Depending on what you were doing, use event handlers, reporting interfaces, IExecutionBackend, or the ModularPipelines.Testing harness. Do not recreate removed internal types as compatibility shims.

Removed or changedDo this instead
IModule.ModuleRunType and the ModuleRunType enumConfigure .WithAlwaysRun() for cleanup; read module.Configuration.AlwaysRun to inspect the policy
Injecting dependencies dynamically through scheduler APIsDeclare a module's dependencies before execution
ITaggedModule implementations, registration-time metadata customizationModule configuration or the supported attributes
ModuleRegistrationOptions, DeclaredDependency, the DependencyType and WaitResult enumsRemoved with the old registration and scheduling APIs
ModuleActivityTracingInternal; use the PipelineTelemetry constants for activity source and tag names, which are unchanged

DependsOnAttribute<T> no longer derives from DependsOnAttribute. Reflection over DependsOnAttribute alone misses the generic declarations.

Telemetry status tag values did change. See Runtime behavior changes.

Changed contracts​

V3 contractV4 contract
IModuleEstimatedTimeProvider methodsEach method takes a ModuleId instead of a Type, plus a trailing CancellationToken. The sub-module methods have default implementations. Re-key stored estimates that used Type.FullName. Estimates are best-effort and never fail a module
IModuleResultRepository.SaveResultAsync / GetResultAsyncTake a CancellationToken; IsEnabled defaults to true
IPipelineValidator.Validate(IServiceProvider)ValidateAsync(IServiceProvider, CancellationToken); Order defaults to 0
ISecretObfuscatorInternal; supply secrets through ISecretRegistry or [SecretValue], and configure masking with PipelineOptions.Secrets
Custom IFileSystemProviderAlso implement GetAttributes/SetAttributes and the Get/Set creation, last-access, and last-write UTC time members; several other members now have default implementations
Custom IModule implementationsNot supported; derive from Module<T> or SyncModule<T>
Subclasses of DependsOnAttribute, DependsOnAttribute<T>, DependsOnAllModulesInheritingFromAttribute, or SecretValueAttributeThese attributes are sealed; declare dependencies in Configure(module) or use a registration handler

Result repositories and time estimators​

  • Implement the interfaces in ModularPipelines.Reporting.
  • Register with builder.AddResultsRepository<T>() and builder.AddModuleEstimatedTimeProvider<T>().
  • Keep repository enablement (IsEnabled), generic result types, and the new result metadata consistent when you update stored data.

Test helpers​

Move legacy private test helpers to ModularPipelines.Testing. Use command interception to supply CommandResult.Ok(...) without launching real tools.

Analyzer IDs​

Analyzer IDs are consolidated under MP####. Update .editorconfig, NoWarn, and #pragma entries with the analyzer ID migration table.

Source-generator diagnostics use the separate MPG#### family. Fix missing or incompatible metadata rather than suppressing it.