From f91f5f6a2132a4aeafa0679423a3b4055b32db5f Mon Sep 17 00:00:00 2001
From: brian-reichle <18721383+brian-reichle@users.noreply.github.com>
Date: Sun, 8 Jun 2025 11:56:46 +1000
Subject: [PATCH 1/9] Fix outstanding IDE diagnostics.
---
.editorconfig | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/.editorconfig b/.editorconfig
index 3e1faf8..47f4bfc 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -32,6 +32,8 @@ dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
+dotnet_style_namespace_match_folder = false
+
[*.cs]
csharp_style_var_for_built_in_types = true:warning
csharp_style_var_when_type_is_apparent = true:warning
@@ -101,6 +103,9 @@ dotnet_diagnostic.SX1309.severity = warning
dotnet_diagnostic.SA1400.severity = none
dotnet_diagnostic.SA1516.severity = none
+# IDE0079 is broken and produces a lot of false-positives.
+dotnet_diagnostic.IDE0079.severity = none
+
[*.json]
indent_style = space
indent_size = 2
From 5ce0205d35b6a2f8273c1293aa4071f2a123c9c0 Mon Sep 17 00:00:00 2001
From: brian-reichle <18721383+brian-reichle@users.noreply.github.com>
Date: Sun, 8 Jun 2025 11:58:31 +1000
Subject: [PATCH 2/9] Update analyzer packages.
---
src/TextTools.Test/TextTools.Test.csproj | 6 +++---
src/TextTools/TextTools.csproj | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/TextTools.Test/TextTools.Test.csproj b/src/TextTools.Test/TextTools.Test.csproj
index 3171290..3f9b564 100644
--- a/src/TextTools.Test/TextTools.Test.csproj
+++ b/src/TextTools.Test/TextTools.Test.csproj
@@ -3,7 +3,7 @@
net472;netcoreapp3.1;net6.0
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
@@ -14,8 +14,8 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/TextTools/TextTools.csproj b/src/TextTools/TextTools.csproj
index 6556934..e8282f4 100644
--- a/src/TextTools/TextTools.csproj
+++ b/src/TextTools/TextTools.csproj
@@ -10,11 +10,11 @@
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
From 6aef25c98b5ab13997fb55efec083090041c7b17 Mon Sep 17 00:00:00 2001
From: brian-reichle <18721383+brian-reichle@users.noreply.github.com>
Date: Sun, 8 Jun 2025 12:16:43 +1000
Subject: [PATCH 3/9] Update SDK to 9.0.100.
---
.github/workflows/build.yaml | 4 ++++
global.json | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index f21ded0..3ae2c61 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -30,6 +30,10 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.202
+ - name: Setup .NET Core 9.0
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: 9.0.100
- name: Build TypeNameInterpretation
run: dotnet build src --configuration ${{ matrix.configuration }}
- name: Run Tests
diff --git a/global.json b/global.json
index 8a1f68e..2bc13e8 100644
--- a/global.json
+++ b/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "6.0.4",
+ "version": "9.0.100",
"rollForward": "latestMinor"
}
}
From cee0d5c075874f06f8cc78083318ba737919669a Mon Sep 17 00:00:00 2001
From: brian-reichle <18721383+brian-reichle@users.noreply.github.com>
Date: Sun, 8 Jun 2025 12:25:45 +1000
Subject: [PATCH 4/9] Add target frameworks for net8.0 and net9.0.
---
.editorconfig | 3 +++
src/TextTools.Test/TextTools.Test.csproj | 2 +-
src/TextTools/TextTools.csproj | 4 +++-
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/.editorconfig b/.editorconfig
index 47f4bfc..a5eaf5c 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -103,6 +103,9 @@ dotnet_diagnostic.SX1309.severity = warning
dotnet_diagnostic.SA1400.severity = none
dotnet_diagnostic.SA1516.severity = none
+# ArgumentException factory methods don't exist in all supported frameworks.
+dotnet_diagnostic.CA1510.severity = none
+
# IDE0079 is broken and produces a lot of false-positives.
dotnet_diagnostic.IDE0079.severity = none
diff --git a/src/TextTools.Test/TextTools.Test.csproj b/src/TextTools.Test/TextTools.Test.csproj
index 3f9b564..47bd02d 100644
--- a/src/TextTools.Test/TextTools.Test.csproj
+++ b/src/TextTools.Test/TextTools.Test.csproj
@@ -1,6 +1,6 @@
- net472;netcoreapp3.1;net6.0
+ net472;netcoreapp3.1;net6.0;net8.0;net9.0
diff --git a/src/TextTools/TextTools.csproj b/src/TextTools/TextTools.csproj
index e8282f4..dd4acab 100644
--- a/src/TextTools/TextTools.csproj
+++ b/src/TextTools/TextTools.csproj
@@ -1,6 +1,6 @@
- net46;netstandard2.0;netstandard2.1;netcoreapp3.1;net6.0
+ net46;netstandard2.0;netstandard2.1;netcoreapp3.1;net6.0;net8.0
enable
8.0
@@ -50,6 +50,8 @@
+
+
true
From 4f7c15f5e7a9de08262ac639ec3956d4fe560ae0 Mon Sep 17 00:00:00 2001
From: brian-reichle <18721383+brian-reichle@users.noreply.github.com>
Date: Sun, 8 Jun 2025 12:29:02 +1000
Subject: [PATCH 5/9] Drop support for obsolete frameworks.
---
.github/workflows/build.yaml | 8 --------
.../{FormatStringTest.net6.cs => FormatStringTest.net.cs} | 2 +-
src/TextTools.Test/TestUtils/DummySpanFormattable.cs | 2 +-
src/TextTools.Test/TextTools.Test.csproj | 2 +-
src/TextTools/Format/FormatString.cs | 6 +++---
src/TextTools/StringBuilderSpanExtensions.cs | 4 ++--
src/TextTools/StringPool/StringPool.cs | 2 +-
src/TextTools/TextTools.csproj | 6 +-----
8 files changed, 10 insertions(+), 22 deletions(-)
rename src/TextTools.Test/Format/{FormatStringTest.net6.cs => FormatStringTest.net.cs} (98%)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 3ae2c61..e381e23 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -22,14 +22,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- - name: Setup .NET Core 3.1
- uses: actions/setup-dotnet@v4
- with:
- dotnet-version: 3.1.402
- - name: Setup .NET Core 6.0
- uses: actions/setup-dotnet@v4
- with:
- dotnet-version: 6.0.202
- name: Setup .NET Core 9.0
uses: actions/setup-dotnet@v4
with:
diff --git a/src/TextTools.Test/Format/FormatStringTest.net6.cs b/src/TextTools.Test/Format/FormatStringTest.net.cs
similarity index 98%
rename from src/TextTools.Test/Format/FormatStringTest.net6.cs
rename to src/TextTools.Test/Format/FormatStringTest.net.cs
index 2a58444..3aaf4fb 100644
--- a/src/TextTools.Test/Format/FormatStringTest.net6.cs
+++ b/src/TextTools.Test/Format/FormatStringTest.net.cs
@@ -1,5 +1,5 @@
// Copyright (c) Brian Reichle. All Rights Reserved. Licensed under the MIT License. See License.txt in the project root for license information.
-#if NET6_0_OR_GREATER
+#if NET
using System;
using System.Text;
using Moq;
diff --git a/src/TextTools.Test/TestUtils/DummySpanFormattable.cs b/src/TextTools.Test/TestUtils/DummySpanFormattable.cs
index d23e3d8..a9b5969 100644
--- a/src/TextTools.Test/TestUtils/DummySpanFormattable.cs
+++ b/src/TextTools.Test/TestUtils/DummySpanFormattable.cs
@@ -1,5 +1,5 @@
// Copyright (c) Brian Reichle. All Rights Reserved. Licensed under the MIT License. See License.txt in the project root for license information.
-#if NET6_0_OR_GREATER
+#if NET
using System;
namespace TextTools.Test.TestUtils
diff --git a/src/TextTools.Test/TextTools.Test.csproj b/src/TextTools.Test/TextTools.Test.csproj
index 47bd02d..79f0766 100644
--- a/src/TextTools.Test/TextTools.Test.csproj
+++ b/src/TextTools.Test/TextTools.Test.csproj
@@ -1,6 +1,6 @@
- net472;netcoreapp3.1;net6.0;net8.0;net9.0
+ net472;net8.0;net9.0
diff --git a/src/TextTools/Format/FormatString.cs b/src/TextTools/Format/FormatString.cs
index 9324a54..75d2807 100644
--- a/src/TextTools/Format/FormatString.cs
+++ b/src/TextTools/Format/FormatString.cs
@@ -183,7 +183,7 @@ static StringBuilder AppendValue(this StringBuilder builder, IFormatProvider? fo
return item switch
{
null => builder,
-#if NET6_0_OR_GREATER
+#if NET
ISpanFormattable spanFormattable => builder.AppendSpanFormattableValue(formatProvider, spanFormattable, format),
#endif
IFormattable formattable => builder.AppendFormattableValue(formatProvider, formattable, format),
@@ -194,7 +194,7 @@ static StringBuilder AppendValue(this StringBuilder builder, IFormatProvider? fo
static StringBuilder AppendFormattableValue(this StringBuilder builder, IFormatProvider? formatProvider, IFormattable item, ReadOnlySpan format)
=> builder.Append(item.ToString(format.Length == 0 ? null : format.ToString(), formatProvider));
-#if NET6_0_OR_GREATER
+#if NET
static StringBuilder AppendSpanFormattableValue(this StringBuilder builder, IFormatProvider? formatProvider, ISpanFormattable item, ReadOnlySpan format)
{
var size = 16;
@@ -217,7 +217,7 @@ static StringBuilder AppendSpanFormattableValue(this StringBuilder builder, IFor
static bool TryParseInt(ReadOnlySpan text, out int value)
{
-#if NETCOREAPP || NETSTANDARD2_1_OR_GREATER
+#if NET || NETSTANDARD2_1_OR_GREATER
return int.TryParse(text, NumberStyles.Integer, CultureInfo.InvariantCulture, out value);
#else
return int.TryParse(text.ToString(), NumberStyles.Integer, CultureInfo.InvariantCulture, out value);
diff --git a/src/TextTools/StringBuilderSpanExtensions.cs b/src/TextTools/StringBuilderSpanExtensions.cs
index e4954eb..7b7c8e8 100644
--- a/src/TextTools/StringBuilderSpanExtensions.cs
+++ b/src/TextTools/StringBuilderSpanExtensions.cs
@@ -6,7 +6,7 @@ namespace TextTools
{
public static class StringBuilderSpanExtensions
{
-#if NETCOREAPP || NETSTANDARD2_1_OR_GREATER
+#if NET || NETSTANDARD2_1_OR_GREATER
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
#endif
public static StringBuilder Append(this StringBuilder builder, ReadOnlySpan span)
@@ -16,7 +16,7 @@ public static StringBuilder Append(this StringBuilder builder, ReadOnlySpan text)
static void ResetIndexes(int[] indexes)
{
-#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP
+#if NET || NETSTANDARD2_1_OR_GREATER
Array.Fill(indexes, -1);
#else
for (var i = 0; i < indexes.Length; i++)
diff --git a/src/TextTools/TextTools.csproj b/src/TextTools/TextTools.csproj
index dd4acab..257efb7 100644
--- a/src/TextTools/TextTools.csproj
+++ b/src/TextTools/TextTools.csproj
@@ -1,6 +1,6 @@
- net46;netstandard2.0;netstandard2.1;netcoreapp3.1;net6.0;net8.0
+ net46;netstandard2.0;netstandard2.1;net8.0
enable
8.0
@@ -46,10 +46,6 @@
-
-
-
-
From c65fdb5182287cd311621d89969f3034b2332ea0 Mon Sep 17 00:00:00 2001
From: brian-reichle <18721383+brian-reichle@users.noreply.github.com>
Date: Sun, 8 Jun 2025 12:41:34 +1000
Subject: [PATCH 6/9] Update unit-testing packages.
---
src/TextTools.Test/TextTools.Test.csproj | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/TextTools.Test/TextTools.Test.csproj b/src/TextTools.Test/TextTools.Test.csproj
index 79f0766..094619c 100644
--- a/src/TextTools.Test/TextTools.Test.csproj
+++ b/src/TextTools.Test/TextTools.Test.csproj
@@ -7,10 +7,10 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
From c1e522b14a924c0afeecfb90d3874d8c8d30cfce Mon Sep 17 00:00:00 2001
From: brian-reichle <18721383+brian-reichle@users.noreply.github.com>
Date: Sun, 8 Jun 2025 12:58:36 +1000
Subject: [PATCH 7/9] Update to C# 13.
---
.editorconfig | 1 +
Directory.Build.props | 2 +-
src/TextTools.Test/Format/FormatStringTest.cs | 2 +-
src/TextTools.Test/Format/FormatStringTest.net.cs | 4 ++--
src/TextTools.Test/StringPool/StringPoolTest.cs | 2 +-
5 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/.editorconfig b/.editorconfig
index a5eaf5c..329310a 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -51,6 +51,7 @@ csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_throw_expression = false:none
csharp_style_conditional_delegate_call = true:suggestion
+csharp_style_prefer_primary_constructors = false
# http://source.roslyn.codeplex.com/#Microsoft.CodeAnalysis.CSharp.Workspaces/Formatting/CSharpFormattingOptions.cs
diff --git a/Directory.Build.props b/Directory.Build.props
index 931d900..ded337a 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -12,7 +12,7 @@ CS1591 - Missing XML comment.
-->
618,1030,1701,1702
1591
- 9.0
+ 13.0
enable
0.1.0
diff --git a/src/TextTools.Test/Format/FormatStringTest.cs b/src/TextTools.Test/Format/FormatStringTest.cs
index c5965b1..6b127cf 100644
--- a/src/TextTools.Test/Format/FormatStringTest.cs
+++ b/src/TextTools.Test/Format/FormatStringTest.cs
@@ -120,7 +120,7 @@ public void AppendFormatted_Formattable_EmptyFormat()
new StringBuilder("#"),
mockProvider.Object,
mockItem.Object,
- ReadOnlySpan.Empty)
+ [])
.ToString();
Assert.That(result, Is.EqualTo("#FormattedToString"));
diff --git a/src/TextTools.Test/Format/FormatStringTest.net.cs b/src/TextTools.Test/Format/FormatStringTest.net.cs
index 3aaf4fb..bc2d9f9 100644
--- a/src/TextTools.Test/Format/FormatStringTest.net.cs
+++ b/src/TextTools.Test/Format/FormatStringTest.net.cs
@@ -21,7 +21,7 @@ public void AppendFormatted_SpanFormattable()
new StringBuilder("#"),
mockProvider.Object,
item,
- ReadOnlySpan.Empty)
+ [])
.ToString();
Assert.That(result, Is.EqualTo("#" + new string('x', 15)));
@@ -53,7 +53,7 @@ public void AppendFormatted_SpanFormattable_Grow()
new StringBuilder("#"),
mockProvider.Object,
item,
- ReadOnlySpan.Empty)
+ [])
.ToString();
Assert.That(result, Is.EqualTo("#" + new string('z', 40)));
diff --git a/src/TextTools.Test/StringPool/StringPoolTest.cs b/src/TextTools.Test/StringPool/StringPoolTest.cs
index e1b32d0..334f3eb 100644
--- a/src/TextTools.Test/StringPool/StringPoolTest.cs
+++ b/src/TextTools.Test/StringPool/StringPoolTest.cs
@@ -11,7 +11,7 @@ class StringPoolTest
public void GetString_EmptySpan()
{
var pool = new StringPool();
- Assert.That(pool.GetString(ReadOnlySpan.Empty), Is.SameAs(string.Empty));
+ Assert.That(pool.GetString([]), Is.SameAs(string.Empty));
}
[Test]
From 66af8993609dec55f1d7f847ef8456c53eb82ab2 Mon Sep 17 00:00:00 2001
From: brian-reichle <18721383+brian-reichle@users.noreply.github.com>
Date: Sun, 8 Jun 2025 13:22:22 +1000
Subject: [PATCH 8/9] Update net framework versions.
---
src/TextTools.Test/TextTools.Test.csproj | 2 +-
src/TextTools/TextTools.csproj | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/TextTools.Test/TextTools.Test.csproj b/src/TextTools.Test/TextTools.Test.csproj
index 094619c..a546af2 100644
--- a/src/TextTools.Test/TextTools.Test.csproj
+++ b/src/TextTools.Test/TextTools.Test.csproj
@@ -1,6 +1,6 @@
- net472;net8.0;net9.0
+ net48;net8.0;net9.0
diff --git a/src/TextTools/TextTools.csproj b/src/TextTools/TextTools.csproj
index 257efb7..f43b5c6 100644
--- a/src/TextTools/TextTools.csproj
+++ b/src/TextTools/TextTools.csproj
@@ -1,6 +1,6 @@
- net46;netstandard2.0;netstandard2.1;net8.0
+ net462;netstandard2.0;netstandard2.1;net8.0
enable
8.0
From de6d69bd72449f2dd60e2bf5be320a66b8ebb457 Mon Sep 17 00:00:00 2001
From: brian-reichle <18721383+brian-reichle@users.noreply.github.com>
Date: Sun, 8 Jun 2025 13:24:36 +1000
Subject: [PATCH 9/9] Update System.Memory.
---
src/TextTools/TextTools.csproj | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/TextTools/TextTools.csproj b/src/TextTools/TextTools.csproj
index f43b5c6..b065e4e 100644
--- a/src/TextTools/TextTools.csproj
+++ b/src/TextTools/TextTools.csproj
@@ -57,7 +57,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+