diff --git a/Avalonia.sln b/Avalonia.sln
index 2777f1b923f..2f2acb4bde6 100644
--- a/Avalonia.sln
+++ b/Avalonia.sln
@@ -42,7 +42,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{A689DE
src\Shared\ModuleInitializer.cs = src\Shared\ModuleInitializer.cs
src\Shared\NullableAttributes.cs = src\Shared\NullableAttributes.cs
src\Shared\SourceGeneratorAttributes.cs = src\Shared\SourceGeneratorAttributes.cs
- src\Avalonia.Base\Compatibility\StringCompatibilityExtensions.cs = src\Avalonia.Base\Compatibility\StringCompatibilityExtensions.cs
+ src\Shared\StringCompatibilityExtensions.cs = src\Shared\StringCompatibilityExtensions.cs
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.ReactiveUI", "src\Avalonia.ReactiveUI\Avalonia.ReactiveUI.csproj", "{6417B24E-49C2-4985-8DB2-3AB9D898EC91}"
diff --git a/src/Avalonia.Base/Animation/Cue.cs b/src/Avalonia.Base/Animation/Cue.cs
index c48f2ab6b0b..793bd16f6f4 100644
--- a/src/Avalonia.Base/Animation/Cue.cs
+++ b/src/Avalonia.Base/Animation/Cue.cs
@@ -34,7 +34,7 @@ public static Cue Parse(string value, CultureInfo? culture)
{
string v = value;
- if (value.EndsWith("%"))
+ if (value.EndsWith('%'))
{
v = v.TrimEnd('%');
}
diff --git a/src/Avalonia.Base/Media/Color.cs b/src/Avalonia.Base/Media/Color.cs
index 17ee14e5332..d100fa28226 100644
--- a/src/Avalonia.Base/Media/Color.cs
+++ b/src/Avalonia.Base/Media/Color.cs
@@ -346,7 +346,7 @@ private static bool TryParseCssFormat(string? s, out Color color)
if (workingString.Length >= 11 &&
workingString.StartsWith("rgba(", StringComparison.OrdinalIgnoreCase) &&
- workingString.EndsWith(")", StringComparison.Ordinal))
+ workingString.EndsWith(')'))
{
workingString = workingString.Substring(5, workingString.Length - 6);
prefixMatched = true;
@@ -355,7 +355,7 @@ private static bool TryParseCssFormat(string? s, out Color color)
if (prefixMatched == false &&
workingString.Length >= 10 &&
workingString.StartsWith("rgb(", StringComparison.OrdinalIgnoreCase) &&
- workingString.EndsWith(")", StringComparison.Ordinal))
+ workingString.EndsWith(')'))
{
workingString = workingString.Substring(4, workingString.Length - 5);
prefixMatched = true;
diff --git a/src/Avalonia.Base/Media/Fonts/FontFamilyLoader.cs b/src/Avalonia.Base/Media/Fonts/FontFamilyLoader.cs
index 37992c895e5..2c61ffd4194 100644
--- a/src/Avalonia.Base/Media/Fonts/FontFamilyLoader.cs
+++ b/src/Avalonia.Base/Media/Fonts/FontFamilyLoader.cs
@@ -94,14 +94,14 @@ private static bool IsContainsFile(Uri x, string filePattern, string fileExtensi
{
var path = x.GetUnescapeAbsolutePath();
return path.IndexOf(filePattern, StringComparison.Ordinal) >= 0
- && path.EndsWith(fileExtension, StringComparison.Ordinal);
+ && path.EndsWith(fileExtension, StringComparison.OrdinalIgnoreCase);
}
private static bool IsFontTtfOrOtf(Uri uri)
{
var sourceWithoutArguments = GetSubString(uri.OriginalString, '?');
- return sourceWithoutArguments.EndsWith(".ttf", StringComparison.Ordinal)
- || sourceWithoutArguments.EndsWith(".otf", StringComparison.Ordinal);
+ return sourceWithoutArguments.EndsWith(".ttf", StringComparison.OrdinalIgnoreCase)
+ || sourceWithoutArguments.EndsWith(".otf", StringComparison.OrdinalIgnoreCase);
}
private static (string fileNameWithoutExtension, string extension) GetFileNameAndExtension(
diff --git a/src/Avalonia.Base/Media/HslColor.cs b/src/Avalonia.Base/Media/HslColor.cs
index 84f2149367e..02176d65d72 100644
--- a/src/Avalonia.Base/Media/HslColor.cs
+++ b/src/Avalonia.Base/Media/HslColor.cs
@@ -256,7 +256,7 @@ public static bool TryParse(string? s, out HslColor hslColor)
if (workingString.Length >= 11 &&
workingString.StartsWith("hsla(", StringComparison.OrdinalIgnoreCase) &&
- workingString.EndsWith(")", StringComparison.Ordinal))
+ workingString.EndsWith(')'))
{
workingString = workingString.Substring(5, workingString.Length - 6);
prefixMatched = true;
@@ -265,7 +265,7 @@ public static bool TryParse(string? s, out HslColor hslColor)
if (prefixMatched == false &&
workingString.Length >= 10 &&
workingString.StartsWith("hsl(", StringComparison.OrdinalIgnoreCase) &&
- workingString.EndsWith(")", StringComparison.Ordinal))
+ workingString.EndsWith(')'))
{
workingString = workingString.Substring(4, workingString.Length - 5);
prefixMatched = true;
diff --git a/src/Avalonia.Base/RelativePoint.cs b/src/Avalonia.Base/RelativePoint.cs
index 5f04f4d57f8..c20c279c00a 100644
--- a/src/Avalonia.Base/RelativePoint.cs
+++ b/src/Avalonia.Base/RelativePoint.cs
@@ -164,9 +164,9 @@ public static RelativePoint Parse(string s)
var unit = RelativeUnit.Absolute;
var scale = 1.0;
- if (x.EndsWith("%"))
+ if (x.EndsWith('%'))
{
- if (!y.EndsWith("%"))
+ if (!y.EndsWith('%'))
{
throw new FormatException("If one coordinate is relative, both must be.");
}
diff --git a/src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj b/src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj
index bc36c610c7c..55a72c4af91 100644
--- a/src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj
+++ b/src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj
@@ -118,6 +118,7 @@
+
diff --git a/src/Avalonia.Build.Tasks/GenerateAvaloniaResourcesTask.cs b/src/Avalonia.Build.Tasks/GenerateAvaloniaResourcesTask.cs
index 620cd4723d4..86c04132a08 100644
--- a/src/Avalonia.Build.Tasks/GenerateAvaloniaResourcesTask.cs
+++ b/src/Avalonia.Build.Tasks/GenerateAvaloniaResourcesTask.cs
@@ -88,7 +88,10 @@ private bool PreProcessXamlFiles(List