Fast.Runtime
Public members, parameters, returns, and exceptions
Targets: net8.0;net9.0;net10.0.
Contract and constraints
Shared configuration, assembly discovery, MVC extensions, validation attributes and application context. This package is normally referenced transitively by the web modules; it does not start a host. Configuration registration returns the original IServiceCollection. Options validation and post-configuration exceptions propagate. MAppContext request data is only available when a request exists. LocalIpv4/LocalIpv6 read the server connection address; RemoteIpv4/RemoteIpv6 read Connection.RemoteIpAddress. The old LanIpv4/LanIpv6 members are no longer part of this API.
Installation and examples
Install the package
dotnet add package Fast.RuntimeExample 1
using Fast.Runtime;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Builder;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddConfigurableOptions<FeatureOptions>("Feature");
var app = builder.Build();
app.MapGet("/feature", (Microsoft.Extensions.Options.IOptions<FeatureOptions> options) => options.Value.BatchSize);
app.Run();
public sealed class FeatureOptions : IPostConfigure
{
public int? BatchSize { get; set; }
public void PostConfigure() => BatchSize ??= 50;
}Web-host examples belong in a consumer project using Microsoft.NET.Sdk.Web and a supported .NET target. IaaS examples can be used in an ordinary class library. Registration precedes builder.Build(); configure middleware and endpoints before app.Run(). Samples retain their original code and comments. No host, external service, database operation or client generator was run, and these snippets have not been compiled in this update.
Source reference
Background scope ownership
Outside HTTP requests, helpers no longer allocate hidden scopes or dispose background services when an unrelated request ends. A background operation must own CreateScope/CreateAsyncScope and dispose it after that operation; pass the scoped provider explicitly. Only registered singletons may use the root provider. Explicit UnmanagedObjects belong to application lifetime, not request cleanup.
IRefreshTokenReplayStore.TryConsumeAsync(key, expiresAt, reuseLeewaySeconds, cancellationToken) grants atomic replay consumption. The key is a purpose-prefixed digest and expiry is absolute. MemoryRefreshTokenReplayStore is process-local and must not impersonate an atomic shared backend.
