.NEXT (dotNext) is a set of powerful libraries aimed to improve development productivity and extend .NET API with unique features. Some of these features are planned in future releases of .NET platform but already implemented in the library:
Quick overview of additional features:
- Attachment of user data to an arbitrary objects
- Extended set of atomic operations. Inspired by AtomicInteger and friends from Java
- Fast Reflection
- Fast conversion of bytes to hexadecimal representation and vice versa using
ToHex
andFromHex
methods from Span static class ManualResetEvent
,ReaderWriterLockSlim
and other synchronization primitives now have their asynchronous versions- Atomic memory access operations for arbitrary value types including enums
- PipeExtensions provides high-level I/O operations for pipelines such as string encoding and decoding
- A rich set of high-performance memory buffers for efficient I/O
- String formatting, encoding and decoding with low GC pressure: dynamic char buffers
- Fully-featured Raft implementation
- Fully-featured HyParView implementation
All these things are implemented in 100% managed code on top of existing .NET API without modifications of Roslyn compiler or CoreFX libraries.
Release Date: 11-15-2021
.NEXT 4.0 Release Candidate is out! Its primary focus is .NET 6 support as well as some other key features:
- Native support of C# 10 Interpolated Strings across various buffer types, streams and other I/O enhancements. String building and string encoding/decoding with zero allocation overhead is now a reality
- All asynchronous locks do not allocate tasks anymore in case of lock contention. Instead, they are moved to ValueTask pooling
ValueTaskCompletionSource
andValueTaskCompletionSource<T>
classes are stabilized and used as a core of ValueTask pooling- Introduced Raft-native cluster membership management as proposed in Diego's original paper instead of external discovery mechanism
- Introduced Gossip-based messaging framework
Use this guide to migrate from 3.x.
- Added
DotNext.Span.Shuffle
andDotNext.Collections.Generic.List.Shuffle
extension methods that allow to randomize position of elements within span/collection - Added
DotNext.Collections.Generic.Sequence.Copy
extension method for making copy of the original enumerable collection. The memory for the copy is always rented from the pool - Added
DotNext.Collections.Generic.Collection.PeekRandom
extension method that allows to select random element from the collection - Improved performance of
DotNext.Span.TrimLength
andStringExtensions.TrimLength
extension methods - Introduced
DotNext.Buffers.BufferHelpers.TrimLength
extension methods for ReadOnlyMemory<T> and Memory<T> data types - Improved performance of
DotNext.Buffers.BufferWriter<T>.AddAll
method - Reduced memory allocations by
ElementAt
,FirstOrEmpty
,FirstOrNull
,ForEach
extension methods inDotNext.Collections.Generic.Sequence
class - Added
DotNext.Numerics.BitVector
that allows to convert bool vectors into integral types - Added ability to write interpolated strings to
IBufferWriter<char>
without temporary allocations - Added ability to write interpolated strings to
BufferWriterSlim<char>
. This makesBufferWriterSlim<char>
type as allocation-free alternative to StringBuilder - Introduced a concept of binary-formattable types. See
DotNext.Buffers.IBinaryFormattable<TSelf>
interface for more information - Introduced
Reference<T>
type as a way to pass the reference to the memory location in asynchronous scenarios Box<T>
is replaced withReference<T>
value typeITypeMap<T>
interface and implementing classes allow to associate an arbitrary value with the type- Added overloaded
Result<T, TError>
value type for C-style error handling
- Added support of interpolated string expression as described in this article using
InterpolationExpression.Create
static method - Added support of task pooling to async lambda expressions
- Migration to C# 10 and .NET 6
- Migration to C# 10 and .NET 6
- Unmanaged memory pool has moved to NativeMemory class instead of Marshal.AllocHGlobal method
- Polished
ValueTaskCompletionSource
andValueTaskCompletionSource<T>
data types. Also these types become a foundation for all synchronization primitives within the library - Return types of all methods of asynchronous locks now moved to ValueTask and ValueTask<T> types
- Together with previous change, all asynchronous locks are written on top of
ValueTaskCompletionSource
andValueTaskCompletionSource<T>
data types. It means that these asynchronous locks use task pooling that leads to zero allocation on the heap and low GC latency - Added
AsyncEventHub
synchronization primitve for asynchronous code - Introduced diagnostics and debugging tools for all synchronization primitives: lock contentions, information about suspended callers, et. al.
- Added
DotNext.IO.SequenceBinaryReader.Position
property that allows to obtain the current position of the reader in the underlying sequence - Added
DotNext.IO.SequenceBinaryReader.Read(Span<byte>)
method - Optimized performance of some
ReadXXX
methods ofDotNext.IO.SequenceReader
type - All
WriteXXXAsync
methods ofIAsyncBinaryWriter
are replaced with a singleWriteFormattableAsync
method supporting ISpanFormattable interface. Now you can encode efficiently any type that implements this interface - Added
FileWriter
andFileReader
classes that are tuned for fast file I/O with the ability to access the buffer explicitly - Introduced a concept of a serializable Data Transfer Objects represented by
ISerializable<TSelf>
interface. The interface allows to control the serialization/deserialization behavior on top ofIAsyncBinaryWriter
andIAsyncBinaryReader
interfaces. Thanks to static abstract interface methods, the value of the type can be easily reconstructed from its serialized state - Added support of binary-formattable types to
IAsyncBinaryWriter
andIAsyncBinaryReader
interfaces - Improved performance of
FileBufferingWriter
I/O operations with preallocated file size feature introduced in .NET 6 StreamExtensions.Combine
allows to represent multiple streams as a single stream
- Optimized memory allocation for each hearbeat message emitted by Raft node in leader state
- Fixed compatibility of WAL Interpreter Framework with TCP/UDP transports
- Added support of Raft-native cluster configuration management that allows to use Raft features for managing cluster members instead of external discovery protocol
- Persistent WAL has moved to new implementation of asynchronous locks to reduce the memory allocation
- Added various snapshot building strategies: incremental and inline
- Optimized file I/O performance of persistent WAL
- Reduced the number of opened file descriptors required by persistent WAL
- Improved performance of partitions allocation in persistent WAL with preallocated file size feature introduced in .NET 6
- Fixed packet loss for TCP/UDP transports
- Added read barrier for linearizable reads on Raft follower nodes
- Added transport-agnostic implementation of HyParView membership protocol suitable for Gossip-based messaging
DotNext.AspNetCore.Cluster 4.0.0
- Added configurable HTTP protocol version selection policy
- Added support of leader lease in Raft implementation for optimized read operations
- Added
IRaftCluster.LeadershipToken
property that allows to track leadership transfer - Introduced
IRaftCluster.Readiness
property that represents the readiness probe. The probe indicates whether the cluster member is ready to serve client requests
Changelog for previous versions located here.
The libraries are versioned according with Semantic Versioning 2.0.
Version | .NET compatibility | Support Level |
---|---|---|
0.x | .NET Standard 2.0 | Not Supported |
1.x | .NET Standard 2.0 | Not Supported |
2.x | .NET Standard 2.1 | Not Supported |
3.x | .NET Standard 2.1, .NET 5 | Maintenance |
4.x | .NET 6 | Active development |
Maintenance support level means that new releases will contain bug fixes only.
Philosophy of development process:
- All libraries in .NEXT family are available for the wide range of .NET runtimes: Mono, .NET, Blazor
- Compatibility with R2R/AOT compiler should be checked for every release
- Minimize set of dependencies
- Provide high-quality documentation
- Stay cross-platform
- Provide benchmarks
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the .NET Foundation Code of Conduct. For more information see the Code of Conduct FAQ or contact conduct@dotnetfoundation.org with any additional questions or comments.