ZeroAlloc.TestHelpers 1.3.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package ZeroAlloc.TestHelpers --version 1.3.2
                    
NuGet\Install-Package ZeroAlloc.TestHelpers -Version 1.3.2
                    
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="ZeroAlloc.TestHelpers" Version="1.3.2">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ZeroAlloc.TestHelpers" Version="1.3.2" />
                    
Directory.Packages.props
<PackageReference Include="ZeroAlloc.TestHelpers">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
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 ZeroAlloc.TestHelpers --version 1.3.2
                    
#r "nuget: ZeroAlloc.TestHelpers, 1.3.2"
                    
#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 ZeroAlloc.TestHelpers@1.3.2
                    
#: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=ZeroAlloc.TestHelpers&version=1.3.2
                    
Install as a Cake Addin
#tool nuget:?package=ZeroAlloc.TestHelpers&version=1.3.2
                    
Install as a Cake Tool

ZeroAlloc.TestHelpers

Source-distributed test helpers for the ZeroAlloc.* ecosystem.

Usage

<PackageReference Include="ZeroAlloc.TestHelpers" Version="1.*">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>contentfiles;build</IncludeAssets>
</PackageReference>

The single file AllocationGate.cs compiles directly into your assembly under namespace ZeroAlloc.TestHelpers as internal static class AllocationGate. No runtime DLL dependency.

API

  • AllocationGate.AssertBudget(int budgetBytes, int iterations, Action action, string label) — runs action iterations times after a warmup + forced GC, throws InvalidOperationException if total allocations exceed budgetBytes * iterations.
  • AllocationGate.AssertBudgetValueTask<T>(int budgetBytes, int iterations, Func<ValueTask<T>> action, string label) — same shape for ValueTask<T>-returning APIs; throws if the supplied ValueTask<T> did not complete synchronously (awaiter machinery would pollute the measurement).

Why source-only

Test infrastructure should never appear on a consumer package's public API surface. By compiling into the consumer's assembly as internal, the helper is per-consumer-scoped and zero-cost at consumer-runtime.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.10.0 12,845 11/6/2026
1.9.0 1,907 10/30/2026
1.8.2 827 10/30/2026
1.8.1 429 10/29/2026
1.8.0 3,088 10/17/2026
1.7.3 2,968 10/17/2026
1.7.2 1,128 10/16/2026
1.7.1 901 10/15/2026
1.7.0 1,242 10/12/2026
1.6.2 606 10/12/2026
1.6.1 1,302 10/11/2026
1.6.0 1,972 10/10/2026
1.5.1 1,023 10/7/2026
1.5.0 534 10/2/2026
1.4.0 394 10/1/2026
1.3.3 3,837 9/24/2026
1.3.2 994 9/20/2026
1.3.1 416 9/20/2026
1.3.0 196 9/20/2026
1.2.3 3,804 9/19/2026
Loading failed