Brows.ProcessAgent 1.0.0

dotnet add package Brows.ProcessAgent --version 1.0.0
                    
NuGet\Install-Package Brows.ProcessAgent -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Brows.ProcessAgent" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Brows.ProcessAgent" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Brows.ProcessAgent" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Brows.ProcessAgent --version 1.0.0
                    
#r "nuget: Brows.ProcessAgent, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Brows.ProcessAgent@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Brows.ProcessAgent&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Brows.ProcessAgent&version=1.0.0
                    
Install as a Cake Tool

Brows.ProcessAgent

Launch a process and asynchronously collect its standard output and standard error as lines.

Install the package with dotnet add package Brows.ProcessAgent.

Run a process

ProcessAgent configures the executable and starts it. Start returns a Task<IProcessProxy> that completes after the process exits and its redirected output has been read; awaiting it gives you the proxy. Use OnProxyCreated if you need to observe the proxy while the process is running:

using Brows.Diagnostics;
using System;
using System.Threading;
using System.Threading.Tasks;

static async Task RunAsync(CancellationToken cancellationToken) {
    var agent = new ProcessAgent {
        FileName = "dotnet",
        Arguments = "--info"
    };

    var proxy = await agent.Start(cancellationToken);

    foreach (var item in proxy.Stream.LineItems) {
        var writer = item.Kind == ProcessOutputKind.StandardError
            ? Console.Error
            : Console.Out;
        writer.WriteLine(item.Line);
    }
}

LineItems contains completed lines from both output streams. Each item identifies its source with ProcessOutputKind. The collection is read-only and observable; read it from the returned proxy after Start completes, or observe the proxy supplied through OnProxyCreated and its collection-change notifications while the process is running.

Configuration

Set ProcessAgent properties before calling Start:

Property Purpose
FileName Executable path or name.
Arguments Arguments passed to the executable.
WorkingDirectory Process working directory.
Environment Environment variables to add or override.
UserName, Domain, Password, PasswordInClearText, LoadUserProfile Optional credentials and profile settings, where supported by the platform.
Verb Process-start verb, where supported.
OnProxyCreated Callback invoked synchronously with the proxy before process startup, unless cancellation is requested before it runs; null omits it.
OnErrorCaught Handler for exceptions encountered while closing standard input or retrieving exit metadata. Exceptions from startup and output reading are not sent to it.
StartInfoFixer Optional IProcessStartInfoFixer that can modify start information and retry after a process-start failure.
SynchronizeWithCurrentContext Whether output collection changes are posted to the SynchronizationContext current when Start is called. Defaults to true.
StreamBufferSize Size, in characters, of each buffer used to read standard output and standard error. Zero (the default) uses 4096 characters; negative values cause Start to throw InvalidOperationException synchronously before the process starts, unless the token is already canceled.

When a synchronization context is available, the default SynchronizeWithCurrentContext setting lets UI-bound observers receive collection changes on that context. Without a current context, changes are dispatched on the thread pool. Set SynchronizeWithCurrentContext to false to dispatch collection changes on the thread pool even when a context is available. Only LineItems changes are marshalled; CurrentItem and Line property-change notifications are raised on the output-reading thread. Prefer awaiting Start rather than synchronously blocking on it.

The process's standard input is closed immediately after it starts, so processes that read input receive end-of-file.

Set OnErrorCaught to handle exceptions encountered while closing standard input or retrieving the process exit code and exit time. If it is null, those exceptions fault the returned task. An exception is considered handled when the callback returns normally; exceptions from process startup and output reading are not sent to it.

The OnProxyCreated callback runs synchronously before process startup, but is skipped if cancellation is requested before the callback is invoked; set it to null to omit it. The proxy's Stream is initialized after the process starts. Cancel the supplied token to request termination of the process and cancel the returned task.

Supported frameworks

.NET Framework 4.0 and 4.6.2, .NET Standard 2.0, .NET Core 3.1, and .NET 6, .NET 8, and .NET 10.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 is compatible. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net40 is compatible.  net403 was computed.  net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Brows.ProcessAgent:

Package Downloads
Brows.ProcessAgent.Windows

Launch processes and asynchronously collect their standard output and standard error as lines.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 27 9/29/2026