Frequently asked questions

Pineapple FAQ

What is Pineapple?

Pineapple is a free, open-source C# library from MILL5 that bundles core utilities for .NET 8 and .NET 10 — guard clauses (preconditions), ShortGuid, a deterministic xxHash HashCode, a SQL Server RowVersion type, rate limiting, resource governors, timeouts, exponential backoff, timing scopes, and exception-safe cleanup.

Is Pineapple a port of Google Guava to .NET?

No. Pineapple is inspired by Guava’s philosophy — small, well-named utilities that remove boilerplate — and borrows ideas such as Preconditions, but it is an independent .NET library with its own API.

How do I install Pineapple?

Run dotnet add package Pineapple, or add <PackageReference Include="Pineapple" Version="2.*" /> to your project file. SQL Server helpers are in the separate Pineapple.Data package.

Which .NET versions are supported?

Pineapple 2.x supports .NET 8 and .NET 10, the current long-term-support releases. Pineapple 1.0.41 is the last version for .NET Standard 2.0, .NET Framework, and .NET Core 3.1.

What license is Pineapple released under?

The Apache License 2.0. You can use it in commercial and closed-source software; keep the license notice.

Does Pineapple have dependencies?

The core package depends on K4os.Hash.xxHash, Microsoft.Extensions.Http, and Microsoft.Extensions.Logging.Abstractions. Pineapple.Data adds Microsoft.Data.SqlClient and Microsoft.EntityFrameworkCore.SqlServer.

Should I use Pineapple Preconditions or ArgumentNullException.ThrowIfNull?

.NET 8+ includes ArgumentNullException.ThrowIfNull, ArgumentException.ThrowIfNullOrWhiteSpace, and ArgumentOutOfRangeException.ThrowIfLessThan and friends. Use them for simple cases. Pineapple’s Preconditions add checks .NET does not have — date windows, URI format, empty GUID, type checks, custom conditions with lazy messages, and synchronization-context assertions.

Why use Pineapple's HashCode instead of System.HashCode?

System.HashCode is randomized per process, so its values change between runs. Pineapple’s HashCode uses xxHash32 and is deterministic, which makes it safe for persisted hashes, cache keys, and partitioning.

Is Pineapple thread-safe?

Stateless helpers (Preconditions, ShortGuid encoding, GuidExtensions, Cleanup) are thread-safe. ResourceGoverner, CallsPerMinute, and SafeRateLimiterScope are designed for concurrent use. HashCode accumulator instances and scope objects are meant for a single caller.

Who built Pineapple?

Pineapple was built by Richard Crane, a Microsoft Most Valuable Professional (MVP) and founder of MILL5, a Boston-based Microsoft Gold Partner specializing in cloud, AI, IoT, data analytics and modern application development.

What other open-source projects does MILL5 publish?

MILL5’s open-source family includes FastSearch (fast substring search for .NET), M5.BloomFilter, the yocto IoC container, Polygon.Net, and the macOS utilities Cut & Move and MacEdgeLight.

Where do I report bugs or request features?

Open an issue at https://github.com/MILL5/pineapple/issues or email rich@mill5.com. Pull requests are welcome.