Releases: onix-labs/onixlabs-dotnet
Version 13.0.0
ONIXLabs DotNET Library 13.0.0
We are excited to announce the release of ONIXLabs .NET Library version 13.0.0, now available on NuGet.
This release focuses primarily on including .NET 10.0 as a build target, whilst keeping .NET 8.0 and .NET 9.0 as build targets, and strives to maintain as much backwards compatibility with the previous version, however, as this is a major release, expect some API incompatibilities.
Please note that as this build utilises C# 14, some features may not be available in previous C# versions.
Solution Updates
- Migrated the solution from the old
.slnto the new xml-based.slnxformat. - Reviewed and converted many of the extension methods to C# 14 extension blocks.
- Scoped preconditions to their associated exceptions (backwards compatible).
- Added attrubutes such as
NotNullandCallerArgumentExpressionto preconditions. - Eliminated lots of overloaded methods and constructors due to implicit span conversion.
- Updated the text APIs with consistent constructors that reduce redundant heap allocations.
- Updated the cryptography APIs with consistent constructors that reduce redundant heap allocations.
- Updated lots of XMLDoc documentation, providing enhanced clarity.
Build Updates
- GitHub Actions steps (
checkoutandsetup-dotnet) have been updated to v5. sdk.versioninglobal.jsonhas been updated to10.0.x.TargetFrameworkshas been updated to includenet10.0.
Test Updates
- Unit tests now updated to use xUnit v3 and Microsoft Test Platform.
Version 12.2.0
ONIXLabs DotNET Library 12.2.0
We are excited to announce the release of ONIXLabs .NET Library version 12.2.0, now available on NuGet.
This release focuses on a cleanup of the codebase to improve the build system, so that most of the project configuration is now shared through Directory.Build.props. This also enables cleaner dependency management, and improves implicit imports.
Core Updates
New extension methods Apply and Let are provided to enable cleaner functional programming. These methods are roughly equivalent to apply and let in Kotlin, but have been designed to work with structs as well as classes.
New extension method TryGetNotNull provides utility for obtaining a potentially non-null value, without sacrificing readability in the program's control flow.
Version 12.1.0
ONIXLabs DotNET Library 12.1.0
We are excited to announce the release of ONIXLabs .NET Library version 12.1.0, now available on NuGet.
Numerics Updates
Decimal.SetScale
A new extension method for System.Decimal has been added: SetScale(int) and SetScale(int, MidpointRounding), for controlling the scale (decimal places) of decimal values, and consists of the following behavior:
- Pads the decimal value with trailing zeroes if scale is too low.
- Truncates safely if no precision is lost.
- Throws if truncation would discard non-zero digits, or rounds using the specified
MidpointRoundingmode.
GenericMath.Pow10
A new method under the generic math class provides utility for computing powers of 10 for any numeric type implementing INumber<T> (e.g. int, long, decimal, double, etc.) using an efficient implementation using exponentiation by squaring (O(log n)).
- Typed safely with INumber
- Throws for negative exponents (by design)
Version 12.0.0
ONIXLabs DotNET Library 12.0.0
We are excited to announce the release of ONIXLabs .NET Library version 12.0.0, now available on NuGet.
Core Updates
Extension methods exist for objects, allowing them to be wrapped as Result<T>; for example
public Result<IEnumerable<Account>> GetAccounts()
{
try
{
return Data.AsEnumerable().ToSuccess();
}
catch(Exception exception)
{
return Result.Failure(exception);
}
}A future release will likely include ToFailure for exception results.
Extension methods exist for objects, allowing them to be wrapped as Optional<T>; for example
public Optional<string> GetName()
{
return Data.Single(query)?.Name.ToOptional();
}Note that if Name were null, then this method would return None<string>; otherwise Some<string> for non-null values.
This also works for value-type (struct) objects.
Breaking Changes
Whislt there is a breaking change in this release, it is only minor. The extension methods ToSuccessResult and ToSuccessResultAsync have been renamed to ToSuccess and ToSuccessAsync respectively.
Version 11.3.0
ONIXLabs DotNET Library 11.3.0
We are excited to announce the release of ONIXLabs .NET Library version 11.3.0, now available on NuGet.
Core Updates
The core package now includes an implementation of the Specification pattern:
Specification<T>represents the base class for implementing specifications.CriteriaSpecification<T>represents a specification that wrapsExpression<Func<T, bool>>.
The implementation also includes logical specifications for AND, OR and NOT operations.
Version 11.2.0
ONIXLabs DotNET Library 11.2.0
We are excited to announce the release of ONIXLabs .NET Library version 11.2.0, now available on NuGet.
Core Updates
The following extension methods have been added to System.String:
NthIndexOffind the nth index of acharorstringwithin the currentstringvalue.SubstringBeforeNthobtains the sub-string before the nth index of the specifiedcharorstringvalue.SubstringAfterNthobtains the sub-string after the nth index of the specifiedcharorstringvalue.
Security.Cryptography Updates
Hash and Salt structs now include a Length property that obtains their length in bytes.
Version 11.1.0
ONIXLabs DotNET Library 11.1.0
We are excited to announce the release of ONIXLabs .NET Library version 11.1.0, now available on NuGet.
Core Updates
The entire library now builds against .NET 8.0 and .NET 9.0, therefore supporting the latest LTS and STS releases of the .NET SDK.
The Result<T> class now includes a GetValue method with an out parameter. This can be used to obtain success values inline; for example:
if (call().GetValue(out var value) is Failure<object> failure)
return failure; // Return if call() failed...
// ...or continue with success value in scopeThere are also extension methods to allow any type of value to be wrapped as a Result<T> instance; for example:
return value.ToSuccessResult();
return task.ToSuccessResultAsync(cancellationToken);
Security.Cryptography Updates
NamedHash now implements ISpanParsable<NamedHash>.
PublicKey now implements GetHash, which returns a Hash representation of a public key instance.
Version 11.0.0
ONIXLabs DotNET Library 11
We are excited to announce the release of ONIXLabs .NET Library version 11, now available on NuGet.
Core Updates
New extension methods have been added to obtain DateOnly and TimeOnly components from DateTime instances.
Security.Cryptography Updates
The existing public/private key import/export APIs have been overhauled to provide a cleaner, more consistent, and more robust experience for importing and exporting public and private keys. This now includes support for binary, PKCS8 and PEM imports and exports, including support for encrypted imports and exports.
Breaking Changes
- The
IPublicKeyExportableinterface was originally implemented by private keys from which a public key could be derived. Since this interface name needed to be repurposed for public key implementations that can be exported, the interface name has changed toIPrivateKeyDerivable, indicating that its implementation is intended on private keys, and that something can be derived from the private key. - The
IPrivateKeyImportablePkcs8andIPrivateKeyExportablePkcs8interfaces have been renamed toIPrivateKeyImportableandIPrivateKeyExportable, since they now support import and export APIs other than PKCS8.
Version 10.0.0
ONIXLabs DotNET Library 10
We are excited to announce the release of ONIXLabs .NET Library version 10, now available on NuGet.
This release updates the library to use .NET 9.0 and utilizes new language features in C# 13.
All of the underlying NuGet dependencies have also been updated to the latest available versions, although this has zero impact on the libraries themselves as they are designed to be as lightweight as possible, and therefore dependency free. Notably, it's the test projects that require NuGet dependencies.
Core Updates
Collection initialiser functions now utilise params collections, so there is no longer a need to convert from an array to the desired type.
Breaking Changes
In a move towards immutable, safe code with fewer memory allocations, this release includes several breaking changes cascading from IBinaryConvertible. This interface no longer exposes a ToByteArray method. Instead, a new IMemoryBinaryConvertible interface exists which exposes an AsReadOnlyMemory method. Similarly, ISpanBinaryConvertible has been modified to align, so the method ToReadOnlySpan has been renamed to AsReadOnlySpan. IBinaryConvertible is now a composite of ISpanBinaryConvertible, and IMemoryBinaryConvertible.
Since the IBinaryConvertible and ISpanBinaryConvertible interfaces have changed, this has cascaded into several types in the OnixLabs.Core.Text, and OnixLabs.Security.Cryptography namespaces.
Obsolete APIs have also been removed in this release.
Version 9.5.1
ONIXLabs .NET Library 9.5.1
We are excited to announce the release of ONIXLabs .NET Library version 9.5.1, now available on NuGet.
Cryptography Updates
This version fixes a bug in the SHA 3 implementation, where transforming multiple blocks of data resulted in erroneous hashes. This was due to the sponge state being reset every time HashCore was called, and has now been fixed and tested.