Skip to content

NamedPipeReplServer

A local, same-user listener. Each connection owns one backend instance.

public sealed class NamedPipeReplServer : IAsyncDisposable

NamedPipeReplServer(string, Func<CancellationToken, ValueTask<IRemoteReplBackend>>, Action<Exception>?)

Section titled “NamedPipeReplServer(string, Func<CancellationToken, ValueTask<IRemoteReplBackend>>, Action<Exception>?)”

Starts accepting connections. An already-owned endpoint causes construction to fail.

public NamedPipeReplServer(string pipeName, Func<CancellationToken, ValueTask<IRemoteReplBackend>> backendFactory, Action<Exception>? onError = null)
  • pipeName (string): The local endpoint name.
  • backendFactory (Func<CancellationToken, ValueTask<IRemoteReplBackend>>): Creates the backend that owns one connection.
  • onError (Action<Exception>): Receives the detail of every failure the client sees only as a sanitized error or a dropped connection: a backend method or terminal failure, a connection that failed, a fault that stops the endpoint accepting, and a cleanup failure after DisposeAsync() timed out. It runs on the failing path, possibly for several connections at once, so it should only record the error and be thread-safe; an exception it throws is traced and otherwise ignored.

Connects locally with a caller-specified deadline. The returned client owns its pipe.

public static Task<RemoteReplClient> ConnectAsync(string pipeName, CancellationToken cancellationToken)

Task<RemoteReplClient>

Stops accepting and closes owned pipes, waiting up to five seconds for cancellation callbacks and in-flight sessions.

public ValueTask DisposeAsync()

ValueTask

Gets the accept loop; a fault means the endpoint is no longer being served. The fault is also reported to the error callback, but a host should observe this task to stop or restart in response.

public Task Completion { get; }

Task