Skip to content

Commit 535aa40

Browse files
committed
Update docs, test config, and Dockerfile for .NET 10
- Added GitHub issue templates, workflows, and test config files to the solution. - Clarified XML docs in ThrowHelper for exception types. - Removed unused InternalsVisibleTo for Memory.Sequential.UnitTests. - Increased test session timeout to 20 minutes. - Refactored linuxtest.dockerfile: use only .NET 10 SDK, removed old SDK layers, set Release build, and disabled CLI telemetry/logo.
1 parent 644c878 commit 535aa40

5 files changed

Lines changed: 49 additions & 49 deletions

File tree

Source/KZDev.PerfUtils.slnx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,12 @@
7878
<File Path="Docs/templates/custom/public/main.css" />
7979
</Folder>
8080
<Folder Name="/GitHub/" />
81+
<Folder Name="/GitHub/IssueTemplates/">
82+
<File Path="../.github/ISSUE_TEMPLATE/bug_report.md" />
83+
<File Path="../.github/ISSUE_TEMPLATE/feature_request.md" />
84+
</Folder>
8185
<Folder Name="/GitHub/WorkFlows/">
86+
<File Path="../.github/workflows/ci.yml" />
8287
<File Path="../.github/workflows/docfx-publish.yml" />
8388
</Folder>
8489
<Folder Name="/Notes/">
@@ -130,7 +135,10 @@
130135
<File Path="linuxtest.dockerfile" />
131136
<File Path="Tst/Directory.Build.props" />
132137
<File Path="Tst/Directory.Packages.props" />
138+
<File Path="Tst/KZDev.PerfUtils.tests.runsettings" />
133139
<File Path="Tst/README.md" />
140+
<File Path="Tst/xunit.runner.explicit.json" />
141+
<File Path="Tst/xunit.runner.json" />
134142
<Project Path="Tst/KZDev.PerfUtils.Common.UnitTests/KZDev.PerfUtils.Common.UnitTests.csproj">
135143
<BuildType Solution="Package|*" Project="Release" />
136144
<Build Solution="Profile|*" Project="false" />

Source/Src/KZDev.PerfUtils/Helpers/ThrowHelper.cs

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ namespace KZDev.PerfUtils.Helpers;
99

1010
//################################################################################
1111
/// <summary>
12-
/// Helper class for throwing exceptions.
12+
/// Centralizes throwing common argument, state, and I/O exceptions using localized
13+
/// messages from <see cref="Strings"/>.
1314
/// </summary>
1415
[ExcludeFromCodeCoverage]
1516
internal static class ThrowHelper
@@ -18,7 +19,7 @@ internal static class ThrowHelper
1819

1920
//--------------------------------------------------------------------------------
2021
/// <summary>
21-
/// Throws an argument out of range exception with the message for a non-negative number.
22+
/// Throws an ArgumentOutOfRangeException with the message for a non-negative number.
2223
/// </summary>
2324
/// <param name="argumentName">The name of the invalid argument.</param>
2425
/// <exception cref="ArgumentOutOfRangeException">
@@ -28,7 +29,7 @@ internal static void ThrowArgumentOutOfRangeException_NeedNonNegNum (string argu
2829
throw new ArgumentOutOfRangeException(argumentName, string.Format(Strings.Arg_OutOfRangeNonNegNum, argumentName));
2930
//--------------------------------------------------------------------------------
3031
/// <summary>
31-
/// Throws an argument out of range exception with the message for a number required
32+
/// Throws an ArgumentOutOfRangeException with the message for a number required
3233
/// to be between two values.
3334
/// </summary>
3435
/// <param name="argumentName">
@@ -48,7 +49,7 @@ internal static void ThrowArgumentOutOfRangeException_NeedBetween (string argume
4849
throw new ArgumentOutOfRangeException(argumentName, string.Format(Strings.Arg_OutOfRangeNeedBetween, argumentName, minimumValue, maximumValue));
4950
//--------------------------------------------------------------------------------
5051
/// <summary>
51-
/// Throws an argument out of range exception with the message for a number required
52+
/// Throws an ArgumentOutOfRangeException with the message for a number required
5253
/// to be greater than or equal to a minimum value.
5354
/// </summary>
5455
/// <param name="argumentName">
@@ -65,7 +66,7 @@ internal static void ThrowArgumentOutOfRangeException_NeedMinValue (string argum
6566
throw new ArgumentOutOfRangeException(argumentName, string.Format(Strings.Arg_OutOfRangeMinValue, argumentName, minimumValue));
6667
//--------------------------------------------------------------------------------
6768
/// <summary>
68-
/// Throws an argument out of range exception with the message for a number required
69+
/// Throws an ArgumentOutOfRangeException with the message for a number required
6970
/// to be less than the size of the collection.
7071
/// </summary>
7172
/// <param name="argumentName">
@@ -77,7 +78,7 @@ internal static void ThrowArgumentOutOfRange_IndexMustBeLessException (string ar
7778
throw new ArgumentOutOfRangeException(argumentName, Strings.Arg_IndexMustBeLessException);
7879
//--------------------------------------------------------------------------------
7980
/// <summary>
80-
/// Throws an argument out of range exception with the message for a number required
81+
/// Throws an ArgumentOutOfRangeException with the message for a number required
8182
/// to be less than or equal to the size of the collection.
8283
/// </summary>
8384
/// <param name="argumentName">
@@ -90,7 +91,7 @@ internal static void ThrowArgumentOutOfRange_IndexMustBeLessOrEqualException (st
9091
throw new ArgumentOutOfRangeException(argumentName, Strings.Arg_IndexMustBeLessOrEqualException);
9192
//--------------------------------------------------------------------------------
9293
/// <summary>
93-
/// Throws an argument exception with the message for an invalid Stream seek origin
94+
/// Throws an ArgumentException with the message for an invalid Stream seek origin
9495
/// value.
9596
/// </summary>
9697
/// <param name="argumentName">
@@ -103,7 +104,7 @@ internal static void ThrowArgumentException_InvalidSeekOrigin (string argumentNa
103104
throw new ArgumentException(Strings.Arg_InvalidSeekOrigin, argumentName);
104105
//--------------------------------------------------------------------------------
105106
/// <summary>
106-
/// Throws an argument with the message for an invalid array segment offset
107+
/// Throws an ArgumentException with the message for an invalid array segment offset
107108
/// and length.
108109
/// </summary>
109110
/// <exception cref="ArgumentException">
@@ -113,7 +114,7 @@ internal static void ThrowArgumentException_InvalidOffsetLength () =>
113114
throw new ArgumentException(Strings.Arg_InvalidOffsetLength);
114115
//--------------------------------------------------------------------------------
115116
/// <summary>
116-
/// Throws an argument with the message for copy destination that is too short
117+
/// Throws an ArgumentException with the message for copy destination that is too short
117118
/// and length.
118119
/// </summary>
119120
/// <param name="argumentName">
@@ -126,7 +127,7 @@ internal static void ThrowArgumentException_DestinationTooShort (string argument
126127
throw new ArgumentException(Strings.Arg_DestinationTooShort, argumentName);
127128
//--------------------------------------------------------------------------------
128129
/// <summary>
129-
/// Throws an argument with the message for a source stream that is not readable
130+
/// Throws an ArgumentException with the message for a source stream that is not readable
130131
/// </summary>
131132
/// <param name="argumentName">
132133
/// The name of the invalid argument.
@@ -138,7 +139,7 @@ internal static void ThrowArgumentException_SourceStreamMustBeReadable (string a
138139
throw new ArgumentException(Strings.Arg_SourceStreamMustBeReadable, argumentName);
139140
//--------------------------------------------------------------------------------
140141
/// <summary>
141-
/// Throws an argument with the message for a source stream that is not seekable
142+
/// Throws an ArgumentException with the message for a source stream that is not seekable
142143
/// </summary>
143144
/// <param name="argumentName">
144145
/// The name of the invalid argument.
@@ -150,7 +151,7 @@ internal static void ThrowArgumentException_SourceStreamMustBeSeekable (string a
150151
throw new ArgumentException(Strings.Arg_SourceStreamMustBeSeekable, argumentName);
151152
//--------------------------------------------------------------------------------
152153
/// <summary>
153-
/// Throws an argument exception with the message for a contained value that is not comparable.
154+
/// Throws an ArgumentException with the message for a contained value that is not comparable.
154155
/// </summary>
155156
/// <param name="argumentName">
156157
/// The name of the invalid argument.
@@ -168,7 +169,7 @@ internal static void ThrowArgumentException_ContainedValueIsNotComparable (strin
168169

169170
//--------------------------------------------------------------------------------
170171
/// <summary>
171-
/// Throws an invalid operation exception with the message for a closed stream.
172+
/// Throws an InvalidOperationException with the message for a closed stream.
172173
/// </summary>
173174
/// <exception cref="InvalidOperationException">
174175
/// </exception>
@@ -177,7 +178,7 @@ internal static void ThrowInvalidOperationException_StreamClosed () =>
177178
throw new InvalidOperationException(Strings.InvalidOperation_StreamClosed);
178179
//--------------------------------------------------------------------------------
179180
/// <summary>
180-
/// Throws an object disposed exception with the message for a closed stream.
181+
/// Throws an ObjectDisposedException with the message for a closed stream.
181182
/// </summary>
182183
/// <param name="objectName">
183184
/// The name of the object that was disposed.
@@ -189,7 +190,7 @@ internal static void ThrowObjectDisposedException_StreamClosed (string objectNam
189190
throw new ObjectDisposedException(objectName, Strings.InvalidOperation_StreamClosed);
190191
//--------------------------------------------------------------------------------
191192
/// <summary>
192-
/// Throws a not supported exception with the message for an unwritable stream.
193+
/// Throws a NotSupportedException with the message for an unwritable stream.
193194
/// </summary>
194195
/// <exception cref="NotSupportedException">
195196
/// </exception>
@@ -198,7 +199,7 @@ internal static void ThrowNotSupportedException_UnwritableStream () =>
198199
throw new NotSupportedException(Strings.NotSupported_UnwritableStream);
199200
//--------------------------------------------------------------------------------
200201
/// <summary>
201-
/// Throws a not supported exception with the message for a feature not supported
202+
/// Throws a NotSupportedException with the message for a feature not supported
202203
/// in the specified stream mode.
203204
/// </summary>
204205
/// <param name="streamMode">
@@ -212,7 +213,7 @@ internal static void ThrowNotSupportedException_InvalidMemoryStreamSlimMode (Mem
212213
streamMode.GetString()));
213214
//--------------------------------------------------------------------------------
214215
/// <summary>
215-
/// Throws a not supported exception with the message for a general feature not supported.
216+
/// Throws a NotSupportedException with the message for a general feature not supported.
216217
/// </summary>
217218
/// <exception cref="NotSupportedException">
218219
/// </exception>
@@ -221,7 +222,7 @@ internal static void ThrowNotSupportedException_FeatureNotSupported () =>
221222
throw new NotSupportedException(Strings.NotSupported_FeatureNotAvailable);
222223
//--------------------------------------------------------------------------------
223224
/// <summary>
224-
/// Throws an argument out of range exception with the message for a small capacity.
225+
/// Throws an ArgumentOutOfRangeException with the message for a small capacity.
225226
/// </summary>
226227
/// <param name="argumentName">
227228
/// The name of the invalid argument.
@@ -233,7 +234,7 @@ internal static void ThrowArgumentOutOfRangeException_CapacitySmall (string argu
233234
throw new ArgumentOutOfRangeException(argumentName, Strings.Arg_OutOfRangeSmallCapacity);
234235
//--------------------------------------------------------------------------------
235236
/// <summary>
236-
/// Throws an argument out of range exception with the message indicating that the
237+
/// Throws an ArgumentOutOfRangeException with the message indicating that the
237238
/// stream length would be invalid.
238239
/// </summary>
239240
/// <exception cref="ArgumentOutOfRangeException">
@@ -243,8 +244,8 @@ internal static void ThrowArgumentOutOfRangeException_StreamLength (string argum
243244
throw new ArgumentOutOfRangeException(argumentName, Strings.Arg_OutOfRangeStreamLength);
244245
//--------------------------------------------------------------------------------
245246
/// <summary>
246-
/// Throws an argument out of range exception with the message indicating that the
247-
/// stream length would be invalid.
247+
/// Throws an ArgumentOutOfRangeException with the message indicating that the
248+
/// requested size is too large for an array.
248249
/// </summary>
249250
/// <exception cref="ArgumentOutOfRangeException">
250251
/// </exception>
@@ -253,7 +254,7 @@ internal static void ThrowArgumentOutOfRangeException_TooLargeForArray(string ar
253254
throw new ArgumentOutOfRangeException(argumentName, Strings.Arg_TooLargeForArray);
254255
//--------------------------------------------------------------------------------
255256
/// <summary>
256-
/// Throws an IO exception with the message for the stream being too long.
257+
/// Throws an IOException with the message for the stream being too long.
257258
/// </summary>
258259
/// <exception cref="IOException">
259260
/// </exception>
@@ -262,7 +263,7 @@ internal static void ThrowIOException_StreamTooLong () =>
262263
throw new IOException(Strings.IO_StreamTooLong);
263264
//--------------------------------------------------------------------------------
264265
/// <summary>
265-
/// Throws an IO exception with the message for an attempt to move the position
266+
/// Throws an IOException with the message for an attempt to move the position
266267
/// before the beginning of the stream.
267268
/// </summary>
268269
/// <exception cref="IOException">
@@ -272,7 +273,7 @@ internal static void ThrowIOException_SeekBeforeBegin () =>
272273
throw new IOException(Strings.IO_SeekBeforeBegin);
273274
//--------------------------------------------------------------------------------
274275
/// <summary>
275-
/// Throws an invalid operation exception with the message for an integer overflow
276+
/// Throws an InvalidOperationException with the message for an integer overflow
276277
/// when calculating the new capacity or accessing the Int32 Capacity property of a stream.
277278
/// </summary>
278279
/// <exception cref="InvalidOperationException">
@@ -282,7 +283,7 @@ internal static void ThrowInvalidOperationException_IntOverflowCapacity () =>
282283
throw new InvalidOperationException(Strings.InvalidOperation_IntOverflowCapacity);
283284
//--------------------------------------------------------------------------------
284285
/// <summary>
285-
/// Throws an invalid operation exception with the message for an attempt to copy
286+
/// Throws an InvalidOperationException with the message for an attempt to copy
286287
/// the stream into an array but the length of the stream is too large to fit in an array.
287288
/// </summary>
288289
/// <exception cref="InvalidOperationException">
@@ -296,7 +297,7 @@ internal static void ThrowInvalidOperationException_TooLargeToCopyToArray () =>
296297

297298
//--------------------------------------------------------------------------------
298299
/// <summary>
299-
/// Throws an invalid operation exception with the message for a type of global settings
300+
/// Throws an InvalidOperationException with the message for a type of global settings
300301
/// that cannot be updated.
301302
/// </summary>
302303
/// <param name="classTypeName">
@@ -310,7 +311,7 @@ internal static void ThrowInvalidOperation_GlobalSettingsCantBeUpdated (string c
310311
classTypeName));
311312
//--------------------------------------------------------------------------------
312313
/// <summary>
313-
/// Throws an object disposed exception with the object name.
314+
/// Throws an ObjectDisposedException for the object identified by the specified name.
314315
/// </summary>
315316
/// <param name="objectName">
316317
/// The name of the object that was disposed.

Source/Src/KZDev.PerfUtils/KZDev.PerfUtils.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
<InternalsVisibleTo Include="KZDev.PerfUtils.Memory.Fixed.UnitTests" />
3535
<InternalsVisibleTo Include="KZDev.PerfUtils.Memory.Native.UnitTests" />
3636
<InternalsVisibleTo Include="KZDev.PerfUtils.Memory.Heap.UnitTests" />
37-
<InternalsVisibleTo Include="KZDev.PerfUtils.Memory.Sequential.UnitTests" />
3837
<InternalsVisibleTo Include="KZDev.PerfUtils.Memory.Heap.Sequential.UnitTests" />
3938
<InternalsVisibleTo Include="KZDev.PerfUtils.Memory.Native.Sequential.UnitTests" />
4039
<InternalsVisibleTo Include="KZDev.PerfUtils.Strings.UnitTests" />

Source/Tst/KZDev.PerfUtils.tests.runsettings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
-->
77
<RunConfiguration>
88
<MaxCpuCount>8</MaxCpuCount>
9-
<TestSessionTimeout>600000</TestSessionTimeout>
9+
<TestSessionTimeout>1200000</TestSessionTimeout>
1010
</RunConfiguration>
1111
</RunSettings>

Source/linuxtest.dockerfile

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,23 @@
1-
# Use the official .NET 6 SDK image as the base image for .NET 6
2-
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS dotnet6
1+
# Linux test image: .NET SDK 10 matches Source/global.json and CI (Build / Test workflow).
2+
# The SDK restores, builds, and tests net8.0, net9.0, and net10.0 — the package target frameworks
3+
# defined under Source/Src and Source/Tst Directory.Build.props. `dotnet test` on the solution
4+
# runs the standard test suite once per target framework for each multi-targeted test project.
5+
FROM mcr.microsoft.com/dotnet/sdk:10.0
36

4-
# Use the official .NET 8 SDK image as the base image for .NET 8
5-
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS dotnet8
6-
7-
# Use the official .NET 9 SDK image as the base image for .NET 8
8-
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS final
9-
10-
# Install .NET 6 SDK
11-
COPY --from=dotnet6 /usr/share/dotnet /usr/share/dotnet
12-
COPY --from=dotnet6 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
13-
14-
# Install .NET 6 SDK
15-
COPY --from=dotnet8 /usr/share/dotnet /usr/share/dotnet
16-
COPY --from=dotnet8 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
7+
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 \
8+
DOTNET_NOLOGO=1
179

1810
# Set the working directory inside the container
1911
WORKDIR /app
2012

21-
# Copy the project files to the container
13+
# Build context is the Source directory (see Tst/README.md).
2214
COPY . .
2315

2416
# Restore the project dependencies
25-
RUN dotnet restore
17+
RUN dotnet restore KZDev.PerfUtils.slnx
2618

2719
# Build the project
28-
RUN dotnet build --no-restore
20+
RUN dotnet build KZDev.PerfUtils.slnx -c Release --no-restore
2921

30-
# Run the tests
31-
CMD ["dotnet", "test", "--no-build", "--logger", "xunit;LogFileName={assembly}.{framework}.results.xml", "--results-directory", "/app/Tst/linux-tests-results"]
22+
# Standard tests only (same as CI job test-standard); all TFMs; Release must match build above.
23+
CMD ["dotnet", "test", "KZDev.PerfUtils.slnx", "-c", "Release", "--no-build", "--logger", "xunit;LogFileName={assembly}.{framework}.results.xml", "--results-directory", "/app/Tst/linux-tests-results"]

0 commit comments

Comments
 (0)