The per-run state exposed to middleware via the chain walker. One instance is constructed per CliInvoke.Core.Middleware.MiddlewareChain.RunAsync(CliInvoke.Core.InvocationContext%2cSystem.Threading.CancellationToken) call and shared by every middleware in the chain; it carries the run's single cancellation token.
public sealed class MiddlewareContext
kind:method, kind:property, kind:ctor. Press Esc to clear.MiddlewareContext(Func<InvocationContext, Task>, CancellationToken, MiddlewareItems?)Initializes a new instance of the MiddlewareContext class.CancellationTokenGets the cancellation token for the chain run this context belongs to. The same token is shared by every middleware in the chain.ItemsGets the items dictionary shared by every middleware in the chain.NextGets the delegate to invoke the next middleware in the chain, or the terminal pipeline for the innermost middleware. The chain walker points this at the forward delegate of the middleware currently executing and restores the caller's value when that middleware returns, so invoking it only ever runs middleware further down the chain, never the current middleware or anything upstream of it. This property is read-only to consumers and retained for diagnostics and introspection. Middleware should normally receive the next delegate via the InvokeAsync(InvocationContext, Func<InvocationContext, Task>) parameter rather than reading it from this property.