Skip to content

Commit 06ed95f

Browse files
committed
Release 5.13.0
1 parent 4071a42 commit 06ed95f

File tree

66 files changed

+1913
-1083
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1913
-1083
lines changed

CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,35 @@
11
Release Notes
22
====
33

4+
# 08-30-2024
5+
<a href="https://www.nuget.org/packages/dotnext/5.13.0">DotNext 5.13.0</a>
6+
* Improved interoperability of `DotNext.Runtime.ValueReference<T>` and `DotNext.Runtime.ReadOnlyValueReference<T>` with .NEXT ecosystem
7+
* Fixed [249](https://github.com/dotnet/dotNext/issues/249)
8+
* Improved codegen quality for ad-hoc enumerator types
9+
10+
<a href="https://www.nuget.org/packages/dotnext.metaprogramming/5.13.0">DotNext.Metaprogramming 5.13.0</a>
11+
* Updated dependencies
12+
13+
<a href="https://www.nuget.org/packages/dotnext.unsafe/5.13.0">DotNext.Unsafe 5.13.0</a>
14+
* Updated dependencies
15+
16+
<a href="https://www.nuget.org/packages/dotnext.threading/5.13.0">DotNext.Threading 5.13.0</a>
17+
* Redesigned `AsyncEventHub` to improve overall performance and reduce memory allocation
18+
* Improved codegen quality for ad-hoc enumerator types
19+
20+
<a href="https://www.nuget.org/packages/dotnext.io/5.13.0">DotNext.IO 5.13.0</a>
21+
* Improved codegen quality for ad-hoc enumerator types
22+
23+
<a href="https://www.nuget.org/packages/dotnext.net.cluster/5.13.0">DotNext.Net.Cluster 5.13.0</a>
24+
* Updated dependencies
25+
26+
<a href="https://www.nuget.org/packages/dotnext.aspnetcore.cluster/5.13.0">DotNext.AspNetCore.Cluster 5.13.0</a>
27+
* Updated dependencies
28+
29+
<a href="https://www.nuget.org/packages/dotnext.maintenanceservices/0.4.0">DotNext.MaintenanceServices 0.4.0</a>
30+
* Added [gc refresh-mem-limit](https://learn.microsoft.com/en-us/dotnet/api/system.gc.refreshmemorylimit) maintenance command
31+
* Updated dependencies
32+
433
# 08-19-2024
534
<a href="https://www.nuget.org/packages/dotnext/5.12.1">DotNext 5.12.1</a>
635
* Added support of static field references to `DotNext.Runtime.ValueReference<T>` data type

README.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,35 @@ All these things are implemented in 100% managed code on top of existing .NET AP
4444
* [NuGet Packages](https://www.nuget.org/profiles/rvsakno)
4545

4646
# What's new
47-
Release Date: 08-19-2024
47+
Release Date: 08-30-2024
4848

49-
<a href="https://www.nuget.org/packages/dotnext/5.12.1">DotNext 5.12.1</a>
50-
* Added support of static field references to `DotNext.Runtime.ValueReference<T>` data type
49+
<a href="https://www.nuget.org/packages/dotnext/5.13.0">DotNext 5.13.0</a>
50+
* Improved interoperability of `DotNext.Runtime.ValueReference<T>` and `DotNext.Runtime.ReadOnlyValueReference<T>` with .NEXT ecosystem
51+
* Fixed [249](https://github.com/dotnet/dotNext/issues/249)
52+
* Improved codegen quality for ad-hoc enumerator types
5153

52-
<a href="https://www.nuget.org/packages/dotnext.threading/5.12.1">DotNext.Threading 5.12.1</a>
53-
* Smallish performance improvements of `RandomAccessCache<TKey, TValue>` class
54+
<a href="https://www.nuget.org/packages/dotnext.metaprogramming/5.13.0">DotNext.Metaprogramming 5.13.0</a>
55+
* Updated dependencies
56+
57+
<a href="https://www.nuget.org/packages/dotnext.unsafe/5.13.0">DotNext.Unsafe 5.13.0</a>
58+
* Updated dependencies
59+
60+
<a href="https://www.nuget.org/packages/dotnext.threading/5.13.0">DotNext.Threading 5.13.0</a>
61+
* Redesigned `AsyncEventHub` to improve overall performance and reduce memory allocation
62+
* Improved codegen quality for ad-hoc enumerator types
63+
64+
<a href="https://www.nuget.org/packages/dotnext.io/5.13.0">DotNext.IO 5.13.0</a>
65+
* Improved codegen quality for ad-hoc enumerator types
66+
67+
<a href="https://www.nuget.org/packages/dotnext.net.cluster/5.13.0">DotNext.Net.Cluster 5.13.0</a>
68+
* Updated dependencies
69+
70+
<a href="https://www.nuget.org/packages/dotnext.aspnetcore.cluster/5.13.0">DotNext.AspNetCore.Cluster 5.13.0</a>
71+
* Updated dependencies
72+
73+
<a href="https://www.nuget.org/packages/dotnext.maintenanceservices/0.4.0">DotNext.MaintenanceServices 0.4.0</a>
74+
* Added [gc refresh-mem-limit](https://learn.microsoft.com/en-us/dotnet/api/system.gc.refreshmemorylimit) maintenance command
75+
* Updated dependencies
5476

5577
Changelog for previous versions located [here](./CHANGELOG.md).
5678

src/Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<!--Misc packages-->
3434
<PackageVersion Include="BenchmarkDotNet" Version="0.13.12" />
3535
<PackageVersion Include="FastMember.Signed" Version="1.5.0" />
36-
<PackageVersion Include="xunit" Version="2.8.0" />
36+
<PackageVersion Include="xunit" Version="2.9.0" />
3737
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.0"/>
3838
<PackageVersion Include="coverlet.collector" Version="6.0.2"/>
3939
</ItemGroup>

src/DotNext.IO/Buffers/SevenBitEncodedInt.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public bool MoveNext()
6868
}
6969

7070
[StructLayout(LayoutKind.Auto)]
71-
internal struct Reader() : IBufferReader, ISupplier<int>
71+
internal struct Reader : IBufferReader, ISupplier<int>
7272
{
7373
private SevenBitEncodedInt value;
7474
private bool completed;

src/DotNext.IO/DotNext.IO.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<Authors>.NET Foundation and Contributors</Authors>
1212
<Company />
1313
<Product>.NEXT Family of Libraries</Product>
14-
<VersionPrefix>5.12.0</VersionPrefix>
14+
<VersionPrefix>5.13.0</VersionPrefix>
1515
<VersionSuffix></VersionSuffix>
1616
<AssemblyName>DotNext.IO</AssemblyName>
1717
<PackageLicenseExpression>MIT</PackageLicenseExpression>

src/DotNext.IO/IO/SequenceReader.cs

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Buffers;
2+
using System.Collections;
23
using System.Diagnostics;
34
using System.Diagnostics.CodeAnalysis;
45
using System.Globalization;
@@ -12,6 +13,7 @@ namespace DotNext.IO;
1213

1314
using Buffers;
1415
using Buffers.Binary;
16+
using Collections.Generic;
1517
using static Pipelines.PipeExtensions;
1618
using DecodingContext = Text.DecodingContext;
1719

@@ -89,7 +91,7 @@ public T Read<T>()
8991
/// <typeparam name="T">The integer type.</typeparam>
9092
/// <returns>The integer value.</returns>
9193
/// <exception cref="EndOfStreamException">The underlying source doesn't contain necessary amount of bytes to decode the value.</exception>
92-
public unsafe T ReadLittleEndian<T>()
94+
public T ReadLittleEndian<T>()
9395
where T : notnull, IBinaryInteger<T>
9496
{
9597
var type = typeof(T);
@@ -111,7 +113,7 @@ public unsafe T ReadLittleEndian<T>()
111113
/// <typeparam name="T">The integer type.</typeparam>
112114
/// <returns>The integer value.</returns>
113115
/// <exception cref="EndOfStreamException">The underlying source doesn't contain necessary amount of bytes to decode the value.</exception>
114-
public unsafe T ReadBigEndian<T>()
116+
public T ReadBigEndian<T>()
115117
where T : notnull, IBinaryInteger<T>
116118
{
117119
var type = typeof(T);
@@ -215,9 +217,12 @@ public bool TryRead(int maxLength, out ReadOnlyMemory<byte> chunk)
215217
chunk = remaining.First.TrimLength(maxLength);
216218
position = remaining.GetPosition(chunk.Length);
217219
}
220+
else
221+
{
222+
chunk = default;
223+
}
218224

219-
chunk = default;
220-
return false;
225+
return !chunk.IsEmpty;
221226
}
222227

223228
/// <summary>
@@ -379,18 +384,15 @@ private unsafe TResult Parse<TArg, TResult>(TArg arg, delegate*<ReadOnlySpan<byt
379384
if (length is 0)
380385
return parser([], arg);
381386

382-
unsafe
387+
if (length <= Parsing256Reader<IFormatProvider?, TResult>.MaxSize)
383388
{
384-
if (length <= Parsing256Reader<IFormatProvider?, TResult>.MaxSize)
385-
{
386-
var reader = new Parsing256Reader<TArg, TResult>(arg, parser, length);
387-
return Read<TResult, Parsing256Reader<TArg, TResult>>(ref reader);
388-
}
389-
else
390-
{
391-
var reader = new ParsingReader<TArg, TResult>(arg, parser, length);
392-
return Read<TResult, ParsingReader<TArg, TResult>>(ref reader);
393-
}
389+
var reader = new Parsing256Reader<TArg, TResult>(arg, parser, length);
390+
return Read<TResult, Parsing256Reader<TArg, TResult>>(ref reader);
391+
}
392+
else
393+
{
394+
var reader = new ParsingReader<TArg, TResult>(arg, parser, length);
395+
return Read<TResult, ParsingReader<TArg, TResult>>(ref reader);
394396
}
395397
}
396398

@@ -744,8 +746,9 @@ ValueTask<MemoryOwner<char>> IAsyncBinaryReader.DecodeAsync(DecodingContext cont
744746
}
745747

746748
/// <inheritdoc/>
747-
IAsyncEnumerable<ReadOnlyMemory<char>> IAsyncBinaryReader.DecodeAsync(DecodingContext context, LengthFormat lengthFormat, Memory<char> buffer, CancellationToken token)
748-
=> Decode(context, lengthFormat, buffer).AsAsyncEnumerable(token);
749+
IAsyncEnumerable<ReadOnlyMemory<char>> IAsyncBinaryReader.DecodeAsync(DecodingContext context, LengthFormat lengthFormat, Memory<char> buffer,
750+
CancellationToken token)
751+
=> Decode(context, lengthFormat, buffer);
749752

750753
/// <inheritdoc/>
751754
ValueTask IAsyncBinaryReader.CopyToAsync(Stream destination, long? count, CancellationToken token)
@@ -839,7 +842,7 @@ readonly bool IAsyncBinaryReader.TryGetRemainingBytesCount(out long count)
839842
/// Represents decoding enumerable.
840843
/// </summary>
841844
[StructLayout(LayoutKind.Auto)]
842-
public readonly struct DecodingEnumerable
845+
public readonly struct DecodingEnumerable : IEnumerable<ReadOnlyMemory<char>>, IAsyncEnumerable<ReadOnlyMemory<char>>
843846
{
844847
private readonly ReadOnlySequence<byte> bytes;
845848
private readonly DecodingContext context;
@@ -859,23 +862,24 @@ internal DecodingEnumerable(ReadOnlySequence<byte> bytes, in DecodingContext con
859862
/// </summary>
860863
/// <returns>The enumerator over decoded chunks of characters.</returns>
861864
public Enumerator GetEnumerator() => new(in bytes, in context, buffer);
865+
866+
/// <inheritdoc />
867+
IEnumerator<ReadOnlyMemory<char>> IEnumerable<ReadOnlyMemory<char>>.GetEnumerator()
868+
=> GetEnumerator().ToClassicEnumerator<Enumerator, ReadOnlyMemory<char>>();
862869

863-
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
864-
internal async IAsyncEnumerable<ReadOnlyMemory<char>> AsAsyncEnumerable([EnumeratorCancellation] CancellationToken token)
865-
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
866-
{
867-
foreach (var chunk in this)
868-
{
869-
token.ThrowIfCancellationRequested();
870-
yield return chunk;
871-
}
872-
}
870+
/// <inheritdoc />
871+
IEnumerator IEnumerable.GetEnumerator()
872+
=> GetEnumerator().ToClassicEnumerator<Enumerator, ReadOnlyMemory<char>>();
873+
874+
/// <inheritdoc />
875+
IAsyncEnumerator<ReadOnlyMemory<char>> IAsyncEnumerable<ReadOnlyMemory<char>>.GetAsyncEnumerator(CancellationToken token)
876+
=> GetEnumerator().ToAsyncEnumerator<Enumerator, ReadOnlyMemory<char>>(token);
873877

874878
/// <summary>
875879
/// Represents enumerator over decoded characters.
876880
/// </summary>
877881
[StructLayout(LayoutKind.Auto)]
878-
public struct Enumerator
882+
public struct Enumerator : IEnumerator<Enumerator, ReadOnlyMemory<char>>
879883
{
880884
private readonly ReadOnlySequence<byte> bytes;
881885
private readonly Decoder decoder;
@@ -899,7 +903,7 @@ internal Enumerator(in ReadOnlySequence<byte> bytes, in DecodingContext context,
899903
/// <summary>
900904
/// Decodes the next chunk of bytes.
901905
/// </summary>
902-
/// <returns><see langword="true"/> if decoding is successfull; <see langword="false"/> if nothing to decode.</returns>
906+
/// <returns><see langword="true"/> if decoding is successful; <see langword="false"/> if nothing to decode.</returns>
903907
public bool MoveNext()
904908
=> (charsWritten = GetChars(in bytes, ref position, decoder, buffer.Span)) > 0;
905909
}
@@ -941,7 +945,7 @@ public ref struct Enumerator
941945
private readonly ReadOnlySequence<byte> bytes;
942946
private readonly Decoder decoder;
943947
private readonly Span<char> buffer;
944-
private ref SequencePosition position;
948+
private readonly ref SequencePosition position;
945949
private int charsWritten;
946950

947951
internal Enumerator(scoped in ReadOnlySequence<byte> bytes, ref SequencePosition position, scoped in DecodingContext context, Span<char> buffer)
@@ -960,7 +964,7 @@ internal Enumerator(scoped in ReadOnlySequence<byte> bytes, ref SequencePosition
960964
/// <summary>
961965
/// Decodes the next chunk of bytes.
962966
/// </summary>
963-
/// <returns><see langword="true"/> if decoding is successfull; <see langword="false"/> if nothing to decode.</returns>
967+
/// <returns><see langword="true"/> if decoding is successful; <see langword="false"/> if nothing to decode.</returns>
964968
public bool MoveNext()
965969
=> (charsWritten = GetChars(in bytes, ref position, decoder, buffer)) > 0;
966970
}

src/DotNext.MaintenanceServices/DotNext.MaintenanceServices.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<Authors>.NET Foundation and Contributors</Authors>
1212
<Company />
1313
<Product>.NEXT Family of Libraries</Product>
14-
<VersionPrefix>0.3.0</VersionPrefix>
14+
<VersionPrefix>0.4.0</VersionPrefix>
1515
<VersionSuffix></VersionSuffix>
1616
<AssemblyName>DotNext.MaintenanceServices</AssemblyName>
1717
<PackageLicenseExpression>MIT</PackageLicenseExpression>

src/DotNext.MaintenanceServices/Maintenance/CommandLine/ApplicationMaintenanceCommand.GCCommand.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ static GCLargeObjectHeapCompactionMode ParseMode(ArgumentResult result)
7676
}
7777
}
7878

79+
private static Command RefreshMemoryLimitsCommand()
80+
{
81+
var command = new ApplicationMaintenanceCommand("refresh-mem-limit", CommandResources.GCRefreshMemoryLimit);
82+
command.SetHandler(GC.RefreshMemoryLimit);
83+
return command;
84+
}
85+
7986
/// <summary>
8087
/// Creates a command that allows to force Garbage Collection.
8188
/// </summary>
@@ -85,6 +92,7 @@ public static ApplicationMaintenanceCommand GCCommand()
8592
var command = new ApplicationMaintenanceCommand("gc", CommandResources.GCCommandDescription);
8693
command.AddCommand(GCCollectCommand());
8794
command.AddCommand(LohCompactionModeCommand());
95+
command.AddCommand(RefreshMemoryLimitsCommand());
8896
return command;
8997
}
9098
}

src/DotNext.MaintenanceServices/Maintenance/CommandLine/Authentication/AuthenticationMiddleware.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ internal static Task SetDefaultPrincipal(InvocationContext context, Func<Invocat
4444
private static void Forbid(InvocationContext context)
4545
{
4646
context.ExitCode = ForbiddenExitCode;
47-
context.Console.Error.Write(CommandResources.AccessDenined);
47+
context.Console.Error.Write(CommandResources.AccessDenied);
4848
context.Console.Error.Write(Environment.NewLine);
4949
}
5050
}

src/DotNext.MaintenanceServices/Maintenance/CommandLine/Authorization/AuthorizationMiddleware.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ internal static async Task AuthorizeAsync(this AuthorizationCallback? globalAuth
1919
}
2020
else
2121
{
22-
console.Error.WriteLine(CommandResources.AccessDenined);
22+
console.Error.WriteLine(CommandResources.AccessDenied);
2323
context.ExitCode = ForbiddenExitCode;
2424
console.Session.IsInteractive = false;
2525
}

0 commit comments

Comments
 (0)