diff --git a/CHANGELOG.md b/CHANGELOG.md
index ab5cac5cd..74e741719 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,35 @@
Release Notes
====
+# 08-30-2024
+DotNext 5.13.0
+* Improved interoperability of `DotNext.Runtime.ValueReference` and `DotNext.Runtime.ReadOnlyValueReference` with .NEXT ecosystem
+* Fixed [249](https://github.com/dotnet/dotNext/issues/249)
+* Improved codegen quality for ad-hoc enumerator types
+
+DotNext.Metaprogramming 5.13.0
+* Updated dependencies
+
+DotNext.Unsafe 5.13.0
+* Updated dependencies
+
+DotNext.Threading 5.13.0
+* Redesigned `AsyncEventHub` to improve overall performance and reduce memory allocation
+* Improved codegen quality for ad-hoc enumerator types
+
+DotNext.IO 5.13.0
+* Improved codegen quality for ad-hoc enumerator types
+
+DotNext.Net.Cluster 5.13.0
+* Updated dependencies
+
+DotNext.AspNetCore.Cluster 5.13.0
+* Updated dependencies
+
+DotNext.MaintenanceServices 0.4.0
+* Added [gc refresh-mem-limit](https://learn.microsoft.com/en-us/dotnet/api/system.gc.refreshmemorylimit) maintenance command
+* Updated dependencies
+
# 08-19-2024
DotNext 5.12.1
* Added support of static field references to `DotNext.Runtime.ValueReference` data type
diff --git a/README.md b/README.md
index 74efc726d..f536b72a5 100644
--- a/README.md
+++ b/README.md
@@ -44,13 +44,35 @@ All these things are implemented in 100% managed code on top of existing .NET AP
* [NuGet Packages](https://www.nuget.org/profiles/rvsakno)
# What's new
-Release Date: 08-19-2024
+Release Date: 08-30-2024
-DotNext 5.12.1
-* Added support of static field references to `DotNext.Runtime.ValueReference` data type
+DotNext 5.13.0
+* Improved interoperability of `DotNext.Runtime.ValueReference` and `DotNext.Runtime.ReadOnlyValueReference` with .NEXT ecosystem
+* Fixed [249](https://github.com/dotnet/dotNext/issues/249)
+* Improved codegen quality for ad-hoc enumerator types
-DotNext.Threading 5.12.1
-* Smallish performance improvements of `RandomAccessCache` class
+DotNext.Metaprogramming 5.13.0
+* Updated dependencies
+
+DotNext.Unsafe 5.13.0
+* Updated dependencies
+
+DotNext.Threading 5.13.0
+* Redesigned `AsyncEventHub` to improve overall performance and reduce memory allocation
+* Improved codegen quality for ad-hoc enumerator types
+
+DotNext.IO 5.13.0
+* Improved codegen quality for ad-hoc enumerator types
+
+DotNext.Net.Cluster 5.13.0
+* Updated dependencies
+
+DotNext.AspNetCore.Cluster 5.13.0
+* Updated dependencies
+
+DotNext.MaintenanceServices 0.4.0
+* Added [gc refresh-mem-limit](https://learn.microsoft.com/en-us/dotnet/api/system.gc.refreshmemorylimit) maintenance command
+* Updated dependencies
Changelog for previous versions located [here](./CHANGELOG.md).
diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props
index eeb6ba5a5..f0b9c57e2 100644
--- a/src/Directory.Packages.props
+++ b/src/Directory.Packages.props
@@ -33,7 +33,7 @@
-
+
diff --git a/src/DotNext.IO/Buffers/SevenBitEncodedInt.cs b/src/DotNext.IO/Buffers/SevenBitEncodedInt.cs
index 25053182f..14d0aebce 100644
--- a/src/DotNext.IO/Buffers/SevenBitEncodedInt.cs
+++ b/src/DotNext.IO/Buffers/SevenBitEncodedInt.cs
@@ -68,7 +68,7 @@ public bool MoveNext()
}
[StructLayout(LayoutKind.Auto)]
- internal struct Reader() : IBufferReader, ISupplier
+ internal struct Reader : IBufferReader, ISupplier
{
private SevenBitEncodedInt value;
private bool completed;
diff --git a/src/DotNext.IO/DotNext.IO.csproj b/src/DotNext.IO/DotNext.IO.csproj
index 26f283b24..97d13b014 100644
--- a/src/DotNext.IO/DotNext.IO.csproj
+++ b/src/DotNext.IO/DotNext.IO.csproj
@@ -11,7 +11,7 @@
.NET Foundation and Contributors
.NEXT Family of Libraries
- 5.12.0
+ 5.13.0
DotNext.IO
MIT
diff --git a/src/DotNext.IO/IO/SequenceReader.cs b/src/DotNext.IO/IO/SequenceReader.cs
index c04a5e7f2..2ff2be3fd 100644
--- a/src/DotNext.IO/IO/SequenceReader.cs
+++ b/src/DotNext.IO/IO/SequenceReader.cs
@@ -1,4 +1,5 @@
using System.Buffers;
+using System.Collections;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
@@ -12,6 +13,7 @@ namespace DotNext.IO;
using Buffers;
using Buffers.Binary;
+using Collections.Generic;
using static Pipelines.PipeExtensions;
using DecodingContext = Text.DecodingContext;
@@ -89,7 +91,7 @@ public T Read()
/// The integer type.
/// The integer value.
/// The underlying source doesn't contain necessary amount of bytes to decode the value.
- public unsafe T ReadLittleEndian()
+ public T ReadLittleEndian()
where T : notnull, IBinaryInteger
{
var type = typeof(T);
@@ -111,7 +113,7 @@ public unsafe T ReadLittleEndian()
/// The integer type.
/// The integer value.
/// The underlying source doesn't contain necessary amount of bytes to decode the value.
- public unsafe T ReadBigEndian()
+ public T ReadBigEndian()
where T : notnull, IBinaryInteger
{
var type = typeof(T);
@@ -215,9 +217,12 @@ public bool TryRead(int maxLength, out ReadOnlyMemory chunk)
chunk = remaining.First.TrimLength(maxLength);
position = remaining.GetPosition(chunk.Length);
}
+ else
+ {
+ chunk = default;
+ }
- chunk = default;
- return false;
+ return !chunk.IsEmpty;
}
///
@@ -379,18 +384,15 @@ private unsafe TResult Parse(TArg arg, delegate*.MaxSize)
{
- if (length <= Parsing256Reader.MaxSize)
- {
- var reader = new Parsing256Reader(arg, parser, length);
- return Read>(ref reader);
- }
- else
- {
- var reader = new ParsingReader(arg, parser, length);
- return Read>(ref reader);
- }
+ var reader = new Parsing256Reader(arg, parser, length);
+ return Read>(ref reader);
+ }
+ else
+ {
+ var reader = new ParsingReader(arg, parser, length);
+ return Read>(ref reader);
}
}
@@ -744,8 +746,9 @@ ValueTask> IAsyncBinaryReader.DecodeAsync(DecodingContext cont
}
///
- IAsyncEnumerable> IAsyncBinaryReader.DecodeAsync(DecodingContext context, LengthFormat lengthFormat, Memory buffer, CancellationToken token)
- => Decode(context, lengthFormat, buffer).AsAsyncEnumerable(token);
+ IAsyncEnumerable> IAsyncBinaryReader.DecodeAsync(DecodingContext context, LengthFormat lengthFormat, Memory buffer,
+ CancellationToken token)
+ => Decode(context, lengthFormat, buffer);
///
ValueTask IAsyncBinaryReader.CopyToAsync(Stream destination, long? count, CancellationToken token)
@@ -839,7 +842,7 @@ readonly bool IAsyncBinaryReader.TryGetRemainingBytesCount(out long count)
/// Represents decoding enumerable.
///
[StructLayout(LayoutKind.Auto)]
- public readonly struct DecodingEnumerable
+ public readonly struct DecodingEnumerable : IEnumerable>, IAsyncEnumerable>
{
private readonly ReadOnlySequence bytes;
private readonly DecodingContext context;
@@ -859,23 +862,24 @@ internal DecodingEnumerable(ReadOnlySequence bytes, in DecodingContext con
///
/// The enumerator over decoded chunks of characters.
public Enumerator GetEnumerator() => new(in bytes, in context, buffer);
+
+ ///
+ IEnumerator> IEnumerable>.GetEnumerator()
+ => GetEnumerator().ToClassicEnumerator>();
-#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
- internal async IAsyncEnumerable> AsAsyncEnumerable([EnumeratorCancellation] CancellationToken token)
-#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
- {
- foreach (var chunk in this)
- {
- token.ThrowIfCancellationRequested();
- yield return chunk;
- }
- }
+ ///
+ IEnumerator IEnumerable.GetEnumerator()
+ => GetEnumerator().ToClassicEnumerator>();
+
+ ///
+ IAsyncEnumerator> IAsyncEnumerable>.GetAsyncEnumerator(CancellationToken token)
+ => GetEnumerator().ToAsyncEnumerator>(token);
///
/// Represents enumerator over decoded characters.
///
[StructLayout(LayoutKind.Auto)]
- public struct Enumerator
+ public struct Enumerator : IEnumerator>
{
private readonly ReadOnlySequence bytes;
private readonly Decoder decoder;
@@ -899,7 +903,7 @@ internal Enumerator(in ReadOnlySequence bytes, in DecodingContext context,
///
/// Decodes the next chunk of bytes.
///
- /// if decoding is successfull; if nothing to decode.
+ /// if decoding is successful; if nothing to decode.
public bool MoveNext()
=> (charsWritten = GetChars(in bytes, ref position, decoder, buffer.Span)) > 0;
}
@@ -941,7 +945,7 @@ public ref struct Enumerator
private readonly ReadOnlySequence bytes;
private readonly Decoder decoder;
private readonly Span buffer;
- private ref SequencePosition position;
+ private readonly ref SequencePosition position;
private int charsWritten;
internal Enumerator(scoped in ReadOnlySequence bytes, ref SequencePosition position, scoped in DecodingContext context, Span buffer)
@@ -960,7 +964,7 @@ internal Enumerator(scoped in ReadOnlySequence bytes, ref SequencePosition
///
/// Decodes the next chunk of bytes.
///
- /// if decoding is successfull; if nothing to decode.
+ /// if decoding is successful; if nothing to decode.
public bool MoveNext()
=> (charsWritten = GetChars(in bytes, ref position, decoder, buffer)) > 0;
}
diff --git a/src/DotNext.MaintenanceServices/DotNext.MaintenanceServices.csproj b/src/DotNext.MaintenanceServices/DotNext.MaintenanceServices.csproj
index fcd66665a..00e3fced3 100644
--- a/src/DotNext.MaintenanceServices/DotNext.MaintenanceServices.csproj
+++ b/src/DotNext.MaintenanceServices/DotNext.MaintenanceServices.csproj
@@ -11,7 +11,7 @@
.NET Foundation and Contributors
.NEXT Family of Libraries
- 0.3.0
+ 0.4.0
DotNext.MaintenanceServices
MIT
diff --git a/src/DotNext.MaintenanceServices/Maintenance/CommandLine/ApplicationMaintenanceCommand.GCCommand.cs b/src/DotNext.MaintenanceServices/Maintenance/CommandLine/ApplicationMaintenanceCommand.GCCommand.cs
index 13f84f743..7cc61cdf2 100644
--- a/src/DotNext.MaintenanceServices/Maintenance/CommandLine/ApplicationMaintenanceCommand.GCCommand.cs
+++ b/src/DotNext.MaintenanceServices/Maintenance/CommandLine/ApplicationMaintenanceCommand.GCCommand.cs
@@ -76,6 +76,13 @@ static GCLargeObjectHeapCompactionMode ParseMode(ArgumentResult result)
}
}
+ private static Command RefreshMemoryLimitsCommand()
+ {
+ var command = new ApplicationMaintenanceCommand("refresh-mem-limit", CommandResources.GCRefreshMemoryLimit);
+ command.SetHandler(GC.RefreshMemoryLimit);
+ return command;
+ }
+
///
/// Creates a command that allows to force Garbage Collection.
///
@@ -85,6 +92,7 @@ public static ApplicationMaintenanceCommand GCCommand()
var command = new ApplicationMaintenanceCommand("gc", CommandResources.GCCommandDescription);
command.AddCommand(GCCollectCommand());
command.AddCommand(LohCompactionModeCommand());
+ command.AddCommand(RefreshMemoryLimitsCommand());
return command;
}
}
\ No newline at end of file
diff --git a/src/DotNext.MaintenanceServices/Maintenance/CommandLine/Authentication/AuthenticationMiddleware.cs b/src/DotNext.MaintenanceServices/Maintenance/CommandLine/Authentication/AuthenticationMiddleware.cs
index 0fee943e9..898f63d25 100644
--- a/src/DotNext.MaintenanceServices/Maintenance/CommandLine/Authentication/AuthenticationMiddleware.cs
+++ b/src/DotNext.MaintenanceServices/Maintenance/CommandLine/Authentication/AuthenticationMiddleware.cs
@@ -44,7 +44,7 @@ internal static Task SetDefaultPrincipal(InvocationContext context, Func (string)Resources.Get();
- internal static string AccessDenined => (string)Resources.Get();
+ internal static string AccessDenied => (string)Resources.Get();
internal static string LoginOptionName => (string)Resources.Get();
@@ -42,6 +42,8 @@ internal static string GCCollectCommandInvalidGenerationArg(string? generation)
internal static string GCLohModeCommandInvalidModeArg(string? mode)
=> Resources.Get().Format(mode);
+ internal static string GCRefreshMemoryLimit => (string)Resources.Get();
+
internal static string InteractiveCommandDescription => (string)Resources.Get();
internal static string ExitCommandDescription => (string)Resources.Get();
diff --git a/src/DotNext.MaintenanceServices/Maintenance/CommandLine/CommandResources.restext b/src/DotNext.MaintenanceServices/Maintenance/CommandLine/CommandResources.restext
index 9c8c64164..519ecb7f8 100644
--- a/src/DotNext.MaintenanceServices/Maintenance/CommandLine/CommandResources.restext
+++ b/src/DotNext.MaintenanceServices/Maintenance/CommandLine/CommandResources.restext
@@ -1,6 +1,6 @@
WelcomeMessage = Welcome to {0} Maintenance Interface! Type -h or --help to get help
CommandTimeoutOccurred=Command has timed out. Please try again
-AccessDenined=Access denied
+AccessDenied=Access denied
GCCommandDescription=Provides interaction with GC
GCCollectCommandDescription=Forces Garbage Collection
GCCollectCommandGenerationArgDescription=The number of the oldest generation to be garbage collected
@@ -10,6 +10,7 @@ GCCollectCommandCompactingOptionDescription=Enables compaction of small object h
GCLohModeCommandDescription=Overrides Large Object Heap compaction mode
GCLohModeCommandModeArgDescription=Large Object Heap compaction mode
GCLohModeCommandInvalidModeArg=Incorrect Large Object Heap compaction mode {0}
+GCRefreshMemoryLimit=Instructs the Garbage Collector to reconfigure itself by detecting the various memory limits on the system
InteractiveCommandDescription=Enters interactive mode
ExitCommandDescription=Leaves interactive mode
ProbeCommandDescription=Invokes application probe
diff --git a/src/DotNext.Metaprogramming/DotNext.Metaprogramming.csproj b/src/DotNext.Metaprogramming/DotNext.Metaprogramming.csproj
index 30c63b4c8..52be6e9bc 100644
--- a/src/DotNext.Metaprogramming/DotNext.Metaprogramming.csproj
+++ b/src/DotNext.Metaprogramming/DotNext.Metaprogramming.csproj
@@ -8,7 +8,7 @@
true
false
nullablePublicOnly
- 5.12.0
+ 5.13.0
.NET Foundation
.NEXT Family of Libraries
diff --git a/src/DotNext.Tests/Buffers/Binary/BinaryTransformationsTests.cs b/src/DotNext.Tests/Buffers/Binary/BinaryTransformationsTests.cs
index c3dabc9ea..630d0d4a4 100644
--- a/src/DotNext.Tests/Buffers/Binary/BinaryTransformationsTests.cs
+++ b/src/DotNext.Tests/Buffers/Binary/BinaryTransformationsTests.cs
@@ -1,5 +1,6 @@
using System.Buffers;
using System.Buffers.Binary;
+using System.Collections;
using System.Runtime.InteropServices;
namespace DotNext.Buffers.Binary;
diff --git a/src/DotNext.Tests/Buffers/BufferWriterTests.cs b/src/DotNext.Tests/Buffers/BufferWriterTests.cs
index 000a3bb13..4f4e3d592 100644
--- a/src/DotNext.Tests/Buffers/BufferWriterTests.cs
+++ b/src/DotNext.Tests/Buffers/BufferWriterTests.cs
@@ -53,13 +53,13 @@ public static async Task ReadWriteBufferedStringAsync(LengthFormat lengthEnc)
await ReadWriteStringUsingEncodingAsync(testString2, Encoding.UTF32, lengthEnc);
}
- public static IEnumerable