NuExt.System 0.7.0

Prefix Reserved
dotnet add package NuExt.System --version 0.7.0
                    
NuGet\Install-Package NuExt.System -Version 0.7.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="NuExt.System" Version="0.7.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NuExt.System" Version="0.7.0" />
                    
Directory.Packages.props
<PackageReference Include="NuExt.System" />
                    
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 NuExt.System --version 0.7.0
                    
#r "nuget: NuExt.System, 0.7.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 NuExt.System@0.7.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=NuExt.System&version=0.7.0
                    
Install as a Cake Addin
#tool nuget:?package=NuExt.System&version=0.7.0
                    
Install as a Cake Tool

NuExt.System

NuExt.System is a lightweight, production-ready foundation for everyday .NET development. It brings together high-quality utilities for asynchrony, lifetime management, threading primitives, high-performance spans/memory helpers, diagnostics, and collection helpers — all with a strong focus on performance, correctness, and developer ergonomics.
Use it to reduce boilerplate, standardize common patterns across projects, and keep code fast and clean across modern .NET and .NET Framework.

Features

  • Asynchrony & lifetime
    • Async locks and wait handles (AsyncLock, ReentrantAsyncLock, AsyncWaitHandle)
    • Disposable tooling (Disposable, AggregateDisposable, AsyncDisposable, AggregateAsyncDisposable, AsyncLifetime)
  • Threading & synchronization
    • Reentrant async lock (context-aware), synchronization context helpers, thread-affine context
  • High-performance spans & memory
    • Backports/polyfills for Span / MemoryExtensions APIs (see below)
    • ValueStringBuilder / ValueListBuilder<T> for zero-allocation building
  • Collections & equality
    • ObservableDictionary<TKey, TValue>, ReferenceEqualityComparer (polyfill), ArrayEqualityComparer, plus many useful extension helpers
  • I/O & paths (cross-platform)
    • PathBuilder (class, IDisposable) and ValuePathBuilder (ref struct) — platform-independent path builders
    • PathUtilities — static helpers for common path operations
  • Diagnostics & utilities
    • ProcessMonitor, PerformanceMonitor, EnumHelper<T>, TypeExtensions, and more

Span / MemoryExtensions Polyfills

This package includes polyfills (API backports) for selected Span / MemoryExtensions-style APIs from newer .NET versions.
On modern runtimes, it transparently uses the inbox implementations; on older runtimes, it provides compatible behavior with the same semantics.

What you get (highlights)

  • Search & comparison: Contains, SequenceEqual (+ IEqualityComparer<T>)
  • Indexing: IndexOf, LastIndexOf (element / sequence)
  • Set-based search: IndexOfAny, LastIndexOfAny, IndexOfAnyExcept, LastIndexOfAnyExcept
  • Range-based: IndexOfAnyInRange, IndexOfAnyExceptInRange, LastIndexOfAnyInRange, LastIndexOfAnyExceptInRange
  • Utilities: StartsWith, EndsWith, Replace (in-place / copy), Count, CountAny

Notes

  • Allocation-free, performance-oriented; value types use bitwise fast paths where applicable.
  • Semantics match the .NET runtime APIs; custom comparers are honored when provided.

Why NuExt.System?

  • Practical: battle-tested building blocks you use every day
  • Fast: zero-alloc paths, tight loops, and careful branching profiles
  • Consistent: same behavior across modern .NET and .NET Framework
  • Focused: no heavy external dependencies or configuration

Compatibility

  • .NET Standard 2.0+, .NET 8/9/10 and .NET Framework 4.6.2+
  • Works across desktop, web, and services (Console, ASP.NET Core, Avalonia, WinUI, WPF, WinForms)

Commonly Used Types

  • Asynchrony & lifetime
    • System.Threading.AsyncLock, System.Threading.ReentrantAsyncLock, System.Threading.AsyncWaitHandle
    • System.ComponentModel.Disposable, AggregateDisposable, AsyncDisposable, AggregateAsyncDisposable, AsyncLifetime
  • Collections & equality
    • System.Collections.ObjectModel.ObservableDictionary<TKey, TValue>
    • System.Collections.Generic.ValueListBuilder<T>
    • System.Collections.Generic.ReferenceEqualityComparer (polyfill)
    • System.Collections.Generic.ArrayEqualityComparer<T>
    • Various useful extension helpers (collections, delegates, enums, strings, exceptions)
  • Strings, spans, and memory
    • System.Text.ValueStringBuilder
    • System.CompatMemoryExtensions (polyfills/backports)
  • I/O & paths (cross-platform)
    • System.IO.PathBuilder (class, IDisposable — mutable path builder)
    • System.IO.ValuePathBuilder (ref struct — high-performance mutable path builder)
    • System.IO.PathUtilities (static common path operations)
  • Diagnostics & helpers
    • System.Diagnostics.ProcessMonitor, PerformanceMonitor
    • System.EnumHelper<T>, System.FormatUtils, System.HexConverter

Installation

Via NuGet:

dotnet add package NuExt.System

Or via Visual Studio:

  1. Go to Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution....
  2. Search for NuExt.System.
  3. Click "Install".

ReentrantAsyncLock Internals

The ReentrantAsyncLock provides a context-aware reentrant async lock. It uses AsyncLocal to track ownership across awaits, allowing the same logical flow to re-enter without deadlocks.

In scenarios that capture ExecutionContext (e.g., CancellationToken.Register), prefer suppressing the flow to avoid leaking AsyncLocal state into callbacks:

var asyncLock = new ReentrantAsyncLock();
var cts = new CancellationTokenSource();

asyncLock.Acquire(() =>
{
    //Don't capture the current ExecutionContext and its AsyncLocals for CancellationToken.Register
    using (ExecutionContext.SuppressFlow())
    {
        cts.Token.Register(() => asyncLock.Acquire(() =>
        {
            // user code
        }));
    }
    //The current ExecutionContext is restored after exiting the using block
});

asyncLock.Acquire(() => cts.Cancel());

Usage Examples

ValueListBuilder<T> and ValueTask.WhenAll
public class Example
{
    public static async Task Main()
    {
        int failed = 0;
        String[] urls = [ "www.adatum.com", "www.cohovineyard.com",
                        "www.cohowinery.com", "www.northwindtraders.com",
                        "www.contoso.com" ];
        var tasks = new ValueListBuilder<ValueTask>(urls.Length);

        foreach (var value in urls)
        {
            var url = value;
            tasks.Append(new ValueTask(Task.Run(() =>
            {
                var png = new Ping();
                try
                {
                    var reply = png.Send(url);
                    if (reply.Status != IPStatus.Success)
                    {
                        Interlocked.Increment(ref failed);
                        throw new TimeoutException("Unable to reach " + url + ".");
                    }
                }
                catch (PingException)
                {
                    Interlocked.Increment(ref failed);
                    throw;
                }
            })));
        }
        ValueTask t = ValueTask.WhenAll(tasks.ToArray());
        try
        {
            await t;
        }
        catch { }

        if (t.IsCompletedSuccessfully)
            Console.WriteLine("All ping attempts succeeded.");
        else if (t.IsFaulted)
            Console.WriteLine("{0} ping attempts failed", failed);
    }
}
ValueListBuilder<T> and ValueTask.WhenAll<TResult>
public class Example
{
    public static async Task Main()
    {
        int failed = 0;
        String[] urls = [ "www.adatum.com", "www.cohovineyard.com",
                        "www.cohowinery.com", "www.northwindtraders.com",
                        "www.contoso.com" ];
        var tasks = new ValueListBuilder<ValueTask<PingReply>>(urls.Length);

        foreach (var value in urls)
        {
            var url = value;
            tasks.Append(new ValueTask<PingReply>(Task.Run(() =>
            {
                var png = new Ping();
                try
                {
                    var reply = png.Send(url);
                    if (reply.Status != IPStatus.Success)
                    {
                        Interlocked.Increment(ref failed);
                        throw new TimeoutException("Unable to reach " + url + ".");
                    }
                    return reply;
                }
                catch (PingException)
                {
                    Interlocked.Increment(ref failed);
                    throw;
                }
            })));
        }
        try
        {
            PingReply[] replies = await ValueTask.WhenAll(tasks.ToArray());
            Console.WriteLine("{0} ping attempts succeeded:", replies.Length);
            for (int i = 0; i < replies.Length; i++)
            {
                var reply = replies[i];
                Console.WriteLine($"Reply from {reply.Address}: bytes={reply.Buffer.Length} time={reply.RoundtripTime}ms TTL={reply.Options?.Ttl} [{urls[i]}]");
            }
        }
        catch (AggregateException)
        {
            Console.WriteLine("{0} ping attempts failed", failed);
        }
    }
}

For comprehensive examples of how to use the package, see:

Acknowledgements

Includes code derived from the .NET Runtime, licensed under the MIT License. The original source code can be found in the .NET Runtime GitHub repository.

Contributing

Issues and PRs are welcome. Keep changes minimal and performance-conscious.

License

MIT. See LICENSE.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 is compatible.  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 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 is compatible.  net472 was computed.  net48 was computed.  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 (4)

Showing the top 4 NuGet packages that depend on NuExt.System:

Package Downloads
NuExt.DevExpress.Mvvm

Provides a suite of extensions and utilities for the DevExpress MVVM Framework with a focus on asynchronous operations. Commonly Used Types: DevExpress.Mvvm.Bindable DevExpress.Mvvm.ViewModel DevExpress.Mvvm.ControlViewModel DevExpress.Mvvm.DocumentContentViewModelBase DevExpress.Mvvm.WindowViewModel DevExpress.Mvvm.AsyncCommandManager DevExpress.Mvvm.IAsyncDialogService DevExpress.Mvvm.IAsyncDocument DevExpress.Mvvm.IAsyncDocumentManagerService DevExpress.Mvvm.UI.OpenWindowsService DevExpress.Mvvm.UI.SettingsService DevExpress.Mvvm.UI.TabbedDocumentUIService DevExpress.Mvvm.UI.WindowPlacementService

NuExt.System.Windows

Provides essential extensions and utilities for Windows application development with a focus on WPF. Commonly Used Types: System.Diagnostics.BindingErrorTraceListener System.IO.IOUtils System.Windows.BindingProxy System.Windows.BindingProxy<T> System.Windows.WindowPlacement System.Windows.IDragDrop

NuExt.System.Data

Provides various extensions for data classes. Commonly Used Types: System.Data.DalBase System.Data.DataReaderExtensions System.Data.DataRowExtensions System.Data.DataTableExtensions System.Data.DalBase System.Data.DbConverter<TDbConnection> System.Data.IDbContext

NuExt.Minimal.Mvvm.Wpf

NuExt.Minimal.Mvvm.Wpf is an extension for the lightweight MVVM framework NuExt.Minimal.Mvvm, specifically designed for WPF applications. Commonly Used Types: Minimal.Mvvm.ModelBase Minimal.Mvvm.Wpf.ControlViewModel Minimal.Mvvm.Wpf.DocumentContentViewModelBase Minimal.Mvvm.Wpf.WindowViewModel Minimal.Mvvm.Wpf.IAsyncDialogService Minimal.Mvvm.Wpf.IAsyncDocument Minimal.Mvvm.Wpf.IAsyncDocumentContent Minimal.Mvvm.Wpf.IAsyncDocumentManagerService Minimal.Mvvm.Wpf.InputDialogService Minimal.Mvvm.Wpf.OpenWindowsService Minimal.Mvvm.Wpf.SettingsService Minimal.Mvvm.Wpf.TabbedDocumentService Minimal.Mvvm.Wpf.ViewLocator Minimal.Mvvm.Wpf.WindowedDocumentService Minimal.Mvvm.Wpf.WindowPlacementService

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.7.0 48 2/12/2026
0.6.0 214 1/11/2026
0.5.2 382 12/15/2025
0.5.1 313 12/14/2025
0.4.1 540 12/10/2025
0.4.0 274 12/5/2025
0.3.5 334 6/13/2025
0.3.4 319 3/6/2025
0.3.3 451 2/21/2025
0.3.2 433 1/22/2025
0.3.1 385 1/19/2025
0.3.0 397 1/13/2025
0.2.0 369 11/14/2024
Loading failed