diff --git a/.editorconfig b/.editorconfig
index 3e1faf8..329310a 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
@@ -49,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
@@ -101,6 +104,12 @@ 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
+
[*.json]
indent_style = space
indent_size = 2
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index f21ded0..e381e23 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -22,14 +22,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- - name: Setup .NET Core 3.1
+ - name: Setup .NET Core 9.0
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
+ dotnet-version: 9.0.100
- name: Build TypeNameInterpretation
run: dotnet build src --configuration ${{ matrix.configuration }}
- name: Run Tests
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/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"
}
}
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.net6.cs b/src/TextTools.Test/Format/FormatStringTest.net.cs
similarity index 94%
rename from src/TextTools.Test/Format/FormatStringTest.net6.cs
rename to src/TextTools.Test/Format/FormatStringTest.net.cs
index 2a58444..bc2d9f9 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;
@@ -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]
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 3171290..a546af2 100644
--- a/src/TextTools.Test/TextTools.Test.csproj
+++ b/src/TextTools.Test/TextTools.Test.csproj
@@ -1,21 +1,21 @@
- net472;netcoreapp3.1;net6.0
+ net48;net8.0;net9.0
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
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 6556934..b065e4e 100644
--- a/src/TextTools/TextTools.csproj
+++ b/src/TextTools/TextTools.csproj
@@ -1,6 +1,6 @@
- net46;netstandard2.0;netstandard2.1;netcoreapp3.1;net6.0
+ net462;netstandard2.0;netstandard2.1;net8.0
enable
8.0
@@ -10,11 +10,11 @@
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
@@ -46,9 +46,7 @@
-
-
-
+
@@ -59,7 +57,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+