Skip to content

datasatanic/dotNext

 
 

Repository files navigation

.NEXT

Build Status License Test Coverage CodeQL Join the chat

.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:

Proposal Implementation
Interop between function pointer and delegate DelegateHelpers factory methods
Check if an instance of T is default(T) IsDefault() method
Concept Types Documentation
Expression Trees covering additional language constructs, i.e. foreach, await, patterns, multi-line lambda expressions Metaprogramming
Async Locks Documentation
High-performance general purpose Write-Ahead Log Persistent Log
Memory-mapped file as Memory<byte> MemoryMappedFileExtensions
Memory-mapped file as ReadOnlySequence<byte> ReadOnlySequenceAccessor
A dictionary where the keys are represented by generic arguments Documentation

Quick overview of additional features:

All these things are implemented in 100% managed code on top of existing .NET API without modifications of Roslyn compiler or CoreFX libraries.

Quick Links

What's new

Release Date: 10-21-2021

.NEXT 4.0 beta 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 and ValueTaskCompletionSource<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.

DotNext 4.0.0

  • Added DotNext.Span.Shuffle and DotNext.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 and StringExtensions.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 in DotNext.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 makes BufferWriterSlim<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 with Reference<T> value type
  • ITypeMap<T> interface and implementing classes allow to associate an arbitrary value with the type

DotNext.Metaprogramming 4.0.0

  • 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

DotNext.Reflection 4.0.0

  • Migration to C# 10 and .NET 6

DotNext.Unsafe 4.0.0

DotNext.Threading 4.0.0

  • Polished ValueTaskCompletionSource and ValueTaskCompletionSource<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 and ValueTaskCompletionSource<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

DotNext.IO 4.0.0

  • 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 of DotNext.IO.SequenceReader type
  • All WriteXXXAsync methods of IAsyncBinaryWriter are replaced with a single WriteFormattableAsync method supporting ISpanFormattable interface. Now you can encode efficiently any type that implements this interface
  • Added FileWriter and FileReader 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 of IAsyncBinaryWriter and IAsyncBinaryReader 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 and IAsyncBinaryReader interfaces
  • Improved performance of FileBufferingWriter I/O operations with preallocated file size feature introduced in .NET 6

DotNext.Net.Cluster 4.0.0

  • 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.

Release & Support Policy

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.

Development Process

Philosophy of development process:

  1. All libraries in .NEXT family are available for the wide range of .NET runtimes: Mono, .NET, Blazor
  2. Compatibility with R2R/AOT compiler should be checked for every release
  3. Minimize set of dependencies
  4. Provide high-quality documentation
  5. Stay cross-platform
  6. Provide benchmarks

Contributing

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.

Packages

 
 
 

Languages

  • C# 100.0%