diff --git a/src/Avalonia.Base/AvaloniaObject.cs b/src/Avalonia.Base/AvaloniaObject.cs
index 2450f1a3a1..0499907ab8 100644
--- a/src/Avalonia.Base/AvaloniaObject.cs
+++ b/src/Avalonia.Base/AvaloniaObject.cs
@@ -210,7 +210,11 @@ namespace Avalonia
/// The value.
public object GetValue(AvaloniaProperty property)
{
- Contract.Requires(property != null);
+ if (property is null)
+ {
+ throw new ArgumentNullException(nameof(property));
+ }
+
VerifyAccess();
if (property.IsDirect)
@@ -231,7 +235,10 @@ namespace Avalonia
/// The value.
public T GetValue(AvaloniaProperty property)
{
- Contract.Requires(property != null);
+ if (property is null)
+ {
+ throw new ArgumentNullException(nameof(property));
+ }
return (T)GetValue((AvaloniaProperty)property);
}