diff --git a/.editorconfig b/.editorconfig
index 1583d3e469..7995062f9f 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -152,6 +152,8 @@ dotnet_diagnostic.CA1820.severity = warning
dotnet_diagnostic.CA1821.severity = warning
# CA1822: Mark members as static
dotnet_diagnostic.CA1822.severity = suggestion
+# CA1823: Avoid unused private fields
+dotnet_diagnostic.CA1823.severity = warning
dotnet_code_quality.CA1822.api_surface = private, internal
# CA1825: Avoid zero-length array allocations
dotnet_diagnostic.CA1825.severity = warning
diff --git a/samples/ControlCatalog/Pages/ImagePage.xaml.cs b/samples/ControlCatalog/Pages/ImagePage.xaml.cs
index 511b01c7ac..5b3169a1b0 100644
--- a/samples/ControlCatalog/Pages/ImagePage.xaml.cs
+++ b/samples/ControlCatalog/Pages/ImagePage.xaml.cs
@@ -70,7 +70,7 @@ namespace ControlCatalog.Pages
3 => new PixelRect(new PixelPoint(bitmapWidth - cropSize.Width, 0), cropSize),
4 => new PixelRect(new PixelPoint(0, bitmapHeight - cropSize.Height), cropSize),
5 => new PixelRect(new PixelPoint(bitmapWidth - cropSize.Width, bitmapHeight - cropSize.Height), cropSize),
- _ => PixelRect.Empty
+ _ => default
};
}
diff --git a/src/Android/Avalonia.Android/Platform/SkiaPlatform/AndroidFramebuffer.cs b/src/Android/Avalonia.Android/Platform/SkiaPlatform/AndroidFramebuffer.cs
index aabf8160f8..94e5f4bd01 100644
--- a/src/Android/Avalonia.Android/Platform/SkiaPlatform/AndroidFramebuffer.cs
+++ b/src/Android/Avalonia.Android/Platform/SkiaPlatform/AndroidFramebuffer.cs
@@ -96,12 +96,14 @@ namespace Avalonia.Android.Platform.SkiaPlatform
public IntPtr bits;
// Do not touch.
+#pragma warning disable CA1823 // Avoid unused private fields
uint reserved1;
uint reserved2;
uint reserved3;
uint reserved4;
uint reserved5;
uint reserved6;
+#pragma warning restore CA1823 // Avoid unused private fields
}
}
}
diff --git a/src/Avalonia.Base/CornerRadius.cs b/src/Avalonia.Base/CornerRadius.cs
index d56a0ef19d..1666fac2e1 100644
--- a/src/Avalonia.Base/CornerRadius.cs
+++ b/src/Avalonia.Base/CornerRadius.cs
@@ -61,9 +61,13 @@ namespace Avalonia
public double BottomLeft { get; }
///
- /// Gets a value indicating whether all corner radii are set to 0.
+ /// Gets a value indicating whether the instance has default values (all corner radii are set to 0).
///
- public bool IsEmpty => TopLeft.Equals(0) && IsUniform;
+ public bool IsDefault => TopLeft == 0 && TopRight == 0 && BottomLeft == 0 && BottomRight == 0;
+
+ ///
+ [Obsolete("Use IsDefault instead.")]
+ public bool IsEmpty => IsDefault;
///
/// Gets a value indicating whether all corner radii are equal.
@@ -79,7 +83,6 @@ namespace Avalonia
{
// ReSharper disable CompareOfFloatsByEqualityOperator
return TopLeft == other.TopLeft &&
-
TopRight == other.TopRight &&
BottomRight == other.BottomRight &&
BottomLeft == other.BottomLeft;
diff --git a/src/Avalonia.Base/Data/Core/ExpressionNode.cs b/src/Avalonia.Base/Data/Core/ExpressionNode.cs
index e4b833176c..5fb2bb5c13 100644
--- a/src/Avalonia.Base/Data/Core/ExpressionNode.cs
+++ b/src/Avalonia.Base/Data/Core/ExpressionNode.cs
@@ -4,8 +4,6 @@ namespace Avalonia.Data.Core
{
public abstract class ExpressionNode
{
- private static readonly object CacheInvalid = new object();
-
protected static readonly WeakReference