diff --git a/src/Avalonia.Base/ApiCompatBaseline.txt b/src/Avalonia.Base/ApiCompatBaseline.txt index d17f25ec49..09baff5af3 100644 --- a/src/Avalonia.Base/ApiCompatBaseline.txt +++ b/src/Avalonia.Base/ApiCompatBaseline.txt @@ -1,4 +1,20 @@ Compat issues with assembly Avalonia.Base: +MembersMustExist : Member 'protected void Avalonia.AvaloniaProperty..ctor(Avalonia.AvaloniaProperty, System.Type, Avalonia.PropertyMetadata)' does not exist in the implementation but it does exist in the contract. +MembersMustExist : Member 'protected void Avalonia.AvaloniaProperty..ctor(System.String, System.Type, System.Type, Avalonia.PropertyMetadata, System.Action)' does not exist in the implementation but it does exist in the contract. +MembersMustExist : Member 'public Avalonia.PropertyMetadata Avalonia.AvaloniaProperty.GetMetadata(System.Type)' does not exist in the implementation but it does exist in the contract. +MembersMustExist : Member 'public Avalonia.PropertyMetadata Avalonia.AvaloniaProperty.GetMetadata()' does not exist in the implementation but it does exist in the contract. +MembersMustExist : Member 'protected void Avalonia.AvaloniaProperty.OverrideMetadata(System.Type, Avalonia.PropertyMetadata)' does not exist in the implementation but it does exist in the contract. +MembersMustExist : Member 'protected void Avalonia.AvaloniaProperty..ctor(Avalonia.AvaloniaProperty, System.Type, Avalonia.PropertyMetadata)' does not exist in the implementation but it does exist in the contract. +MembersMustExist : Member 'protected void Avalonia.AvaloniaProperty..ctor(Avalonia.AvaloniaProperty, System.Type, Avalonia.PropertyMetadata)' does not exist in the implementation but it does exist in the contract. +MembersMustExist : Member 'protected void Avalonia.AvaloniaProperty..ctor(System.String, System.Type, Avalonia.PropertyMetadata, System.Action)' does not exist in the implementation but it does exist in the contract. +MembersMustExist : Member 'protected void Avalonia.DirectPropertyBase..ctor(Avalonia.AvaloniaProperty, System.Type, Avalonia.PropertyMetadata)' does not exist in the implementation but it does exist in the contract. +MembersMustExist : Member 'protected void Avalonia.DirectPropertyBase..ctor(Avalonia.DirectPropertyBase, System.Type, Avalonia.PropertyMetadata)' does not exist in the implementation but it does exist in the contract. +MembersMustExist : Member 'protected void Avalonia.DirectPropertyBase..ctor(System.String, System.Type, Avalonia.PropertyMetadata)' does not exist in the implementation but it does exist in the contract. +CannotRemoveBaseTypeOrInterface : Type 'Avalonia.DirectPropertyMetadata' does not inherit from base type 'Avalonia.PropertyMetadata' in the implementation but it does in the contract. +MembersMustExist : Member 'public void Avalonia.DirectPropertyMetadata.Merge(Avalonia.PropertyMetadata, Avalonia.AvaloniaProperty)' does not exist in the implementation but it does exist in the contract. +TypesMustExist : Type 'Avalonia.PropertyMetadata' does not exist in the implementation but it does exist in the contract. +CannotRemoveBaseTypeOrInterface : Type 'Avalonia.StyledPropertyMetadata' does not inherit from base type 'Avalonia.PropertyMetadata' in the implementation but it does in the contract. +MembersMustExist : Member 'public void Avalonia.StyledPropertyMetadata.Merge(Avalonia.PropertyMetadata, Avalonia.AvaloniaProperty)' does not exist in the implementation but it does exist in the contract. MembersMustExist : Member 'public void Avalonia.Threading.AvaloniaSynchronizationContext..ctor(Avalonia.Threading.AvaloniaSynchronizationContext.INonPumpingPlatformWaitProvider)' does not exist in the implementation but it does exist in the contract. TypesMustExist : Type 'Avalonia.Threading.AvaloniaSynchronizationContext.INonPumpingPlatformWaitProvider' does not exist in the implementation but it does exist in the contract. -Total Issues: 2 +Total Issues: 18 diff --git a/src/Avalonia.Base/AvaloniaProperty.cs b/src/Avalonia.Base/AvaloniaProperty.cs index 3ae0445e9b..5117fdb170 100644 --- a/src/Avalonia.Base/AvaloniaProperty.cs +++ b/src/Avalonia.Base/AvaloniaProperty.cs @@ -17,9 +17,9 @@ namespace Avalonia public static readonly object UnsetValue = new UnsetValueType(); private static int s_nextId; - private readonly PropertyMetadata _defaultMetadata; - private readonly Dictionary _metadata; - private readonly Dictionary _metadataCache = new Dictionary(); + private readonly AvaloniaPropertyMetadata _defaultMetadata; + private readonly Dictionary _metadata; + private readonly Dictionary _metadataCache = new Dictionary(); private bool _hasMetadataOverrides; @@ -35,7 +35,7 @@ namespace Avalonia string name, Type valueType, Type ownerType, - PropertyMetadata metadata, + AvaloniaPropertyMetadata metadata, Action notifying = null) { Contract.Requires(name != null); @@ -48,7 +48,7 @@ namespace Avalonia throw new ArgumentException("'name' may not contain periods."); } - _metadata = new Dictionary(); + _metadata = new Dictionary(); Name = name; PropertyType = valueType; @@ -69,12 +69,12 @@ namespace Avalonia protected AvaloniaProperty( AvaloniaProperty source, Type ownerType, - PropertyMetadata metadata) + AvaloniaPropertyMetadata metadata) { Contract.Requires(source != null); Contract.Requires(ownerType != null); - _metadata = new Dictionary(); + _metadata = new Dictionary(); Name = source.Name; PropertyType = source.PropertyType; @@ -419,7 +419,7 @@ namespace Avalonia /// /// The property metadata. /// - public PropertyMetadata GetMetadata() where T : IAvaloniaObject + public AvaloniaPropertyMetadata GetMetadata() where T : IAvaloniaObject { return GetMetadata(typeof(T)); } @@ -432,7 +432,7 @@ namespace Avalonia /// The property metadata. /// /// - public PropertyMetadata GetMetadata(Type type) + public AvaloniaPropertyMetadata GetMetadata(Type type) { if (!_hasMetadataOverrides) { @@ -521,7 +521,7 @@ namespace Avalonia /// /// The type. /// The metadata. - protected void OverrideMetadata(Type type, PropertyMetadata metadata) + protected void OverrideMetadata(Type type, AvaloniaPropertyMetadata metadata) { Contract.Requires(type != null); Contract.Requires(metadata != null); @@ -542,14 +542,14 @@ namespace Avalonia protected abstract IObservable GetChanged(); - private PropertyMetadata GetMetadataWithOverrides(Type type) + private AvaloniaPropertyMetadata GetMetadataWithOverrides(Type type) { if (type is null) { throw new ArgumentNullException(nameof(type)); } - if (_metadataCache.TryGetValue(type, out PropertyMetadata result)) + if (_metadataCache.TryGetValue(type, out AvaloniaPropertyMetadata result)) { return result; } diff --git a/src/Avalonia.Base/PropertyMetadata.cs b/src/Avalonia.Base/AvaloniaPropertyMetadata.cs similarity index 85% rename from src/Avalonia.Base/PropertyMetadata.cs rename to src/Avalonia.Base/AvaloniaPropertyMetadata.cs index 806051e1d1..2963567b14 100644 --- a/src/Avalonia.Base/PropertyMetadata.cs +++ b/src/Avalonia.Base/AvaloniaPropertyMetadata.cs @@ -5,15 +5,15 @@ namespace Avalonia /// /// Base class for avalonia property metadata. /// - public class PropertyMetadata + public class AvaloniaPropertyMetadata { private BindingMode _defaultBindingMode; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The default binding mode. - public PropertyMetadata( + public AvaloniaPropertyMetadata( BindingMode defaultBindingMode = BindingMode.Default) { _defaultBindingMode = defaultBindingMode; @@ -37,7 +37,7 @@ namespace Avalonia /// The base metadata to merge. /// The property to which the metadata is being applied. public virtual void Merge( - PropertyMetadata baseMetadata, + AvaloniaPropertyMetadata baseMetadata, AvaloniaProperty property) { if (_defaultBindingMode == BindingMode.Default) diff --git a/src/Avalonia.Base/AvaloniaProperty`1.cs b/src/Avalonia.Base/AvaloniaProperty`1.cs index d5549e979b..247ea0a25a 100644 --- a/src/Avalonia.Base/AvaloniaProperty`1.cs +++ b/src/Avalonia.Base/AvaloniaProperty`1.cs @@ -23,7 +23,7 @@ namespace Avalonia protected AvaloniaProperty( string name, Type ownerType, - PropertyMetadata metadata, + AvaloniaPropertyMetadata metadata, Action notifying = null) : base(name, typeof(TValue), ownerType, metadata, notifying) { @@ -40,7 +40,7 @@ namespace Avalonia protected AvaloniaProperty( AvaloniaProperty source, Type ownerType, - PropertyMetadata metadata) + AvaloniaPropertyMetadata metadata) : this(source as AvaloniaProperty ?? throw new InvalidOperationException(), ownerType, metadata) { } @@ -54,7 +54,7 @@ namespace Avalonia protected AvaloniaProperty( AvaloniaProperty source, Type ownerType, - PropertyMetadata metadata) + AvaloniaPropertyMetadata metadata) : base(source, ownerType, metadata) { _changed = source._changed; diff --git a/src/Avalonia.Base/DirectPropertyBase.cs b/src/Avalonia.Base/DirectPropertyBase.cs index a2f113adb7..e6cc1edfdf 100644 --- a/src/Avalonia.Base/DirectPropertyBase.cs +++ b/src/Avalonia.Base/DirectPropertyBase.cs @@ -26,7 +26,7 @@ namespace Avalonia protected DirectPropertyBase( string name, Type ownerType, - PropertyMetadata metadata) + AvaloniaPropertyMetadata metadata) : base(name, ownerType, metadata) { } @@ -41,7 +41,7 @@ namespace Avalonia protected DirectPropertyBase( AvaloniaProperty source, Type ownerType, - PropertyMetadata metadata) + AvaloniaPropertyMetadata metadata) : this(source as DirectPropertyBase ?? throw new InvalidOperationException(), ownerType, metadata) { } @@ -55,7 +55,7 @@ namespace Avalonia protected DirectPropertyBase( DirectPropertyBase source, Type ownerType, - PropertyMetadata metadata) + AvaloniaPropertyMetadata metadata) : base(source, ownerType, metadata) { } diff --git a/src/Avalonia.Base/DirectPropertyMetadata`1.cs b/src/Avalonia.Base/DirectPropertyMetadata`1.cs index 59a60507dc..205967984d 100644 --- a/src/Avalonia.Base/DirectPropertyMetadata`1.cs +++ b/src/Avalonia.Base/DirectPropertyMetadata`1.cs @@ -5,7 +5,7 @@ namespace Avalonia /// /// Metadata for direct avalonia properties. /// - public class DirectPropertyMetadata : PropertyMetadata, IDirectPropertyMetadata + public class DirectPropertyMetadata : AvaloniaPropertyMetadata, IDirectPropertyMetadata { /// /// Initializes a new instance of the class. @@ -47,7 +47,7 @@ namespace Avalonia object IDirectPropertyMetadata.UnsetValue => UnsetValue; /// - public override void Merge(PropertyMetadata baseMetadata, AvaloniaProperty property) + public override void Merge(AvaloniaPropertyMetadata baseMetadata, AvaloniaProperty property) { base.Merge(baseMetadata, property); diff --git a/src/Avalonia.Base/StyledPropertyMetadata`1.cs b/src/Avalonia.Base/StyledPropertyMetadata`1.cs index cf0a0c34ec..ec7bff4dfb 100644 --- a/src/Avalonia.Base/StyledPropertyMetadata`1.cs +++ b/src/Avalonia.Base/StyledPropertyMetadata`1.cs @@ -6,7 +6,7 @@ namespace Avalonia /// /// Metadata for styled avalonia properties. /// - public class StyledPropertyMetadata : PropertyMetadata, IStyledPropertyMetadata + public class StyledPropertyMetadata : AvaloniaPropertyMetadata, IStyledPropertyMetadata { private Optional _defaultValue; @@ -39,7 +39,7 @@ namespace Avalonia object IStyledPropertyMetadata.DefaultValue => DefaultValue; /// - public override void Merge(PropertyMetadata baseMetadata, AvaloniaProperty property) + public override void Merge(AvaloniaPropertyMetadata baseMetadata, AvaloniaProperty property) { base.Merge(baseMetadata, property); diff --git a/tests/Avalonia.Base.UnitTests/AvaloniaPropertyTests.cs b/tests/Avalonia.Base.UnitTests/AvaloniaPropertyTests.cs index 8e5d8b7be2..1adb6988a2 100644 --- a/tests/Avalonia.Base.UnitTests/AvaloniaPropertyTests.cs +++ b/tests/Avalonia.Base.UnitTests/AvaloniaPropertyTests.cs @@ -27,7 +27,7 @@ namespace Avalonia.Base.UnitTests [Fact] public void GetMetadata_Returns_Supplied_Value() { - var metadata = new PropertyMetadata(); + var metadata = new AvaloniaPropertyMetadata(); var target = new TestProperty("test", typeof(Class1), metadata); Assert.Same(metadata, target.GetMetadata()); @@ -36,7 +36,7 @@ namespace Avalonia.Base.UnitTests [Fact] public void GetMetadata_Returns_Supplied_Value_For_Derived_Class() { - var metadata = new PropertyMetadata(); + var metadata = new AvaloniaPropertyMetadata(); var target = new TestProperty("test", typeof(Class1), metadata); Assert.Same(metadata, target.GetMetadata()); @@ -45,7 +45,7 @@ namespace Avalonia.Base.UnitTests [Fact] public void GetMetadata_Returns_Supplied_Value_For_Unrelated_Class() { - var metadata = new PropertyMetadata(); + var metadata = new AvaloniaPropertyMetadata(); var target = new TestProperty("test", typeof(Class3), metadata); Assert.Same(metadata, target.GetMetadata()); @@ -54,8 +54,8 @@ namespace Avalonia.Base.UnitTests [Fact] public void GetMetadata_Returns_Overridden_Value() { - var metadata = new PropertyMetadata(); - var overridden = new PropertyMetadata(); + var metadata = new AvaloniaPropertyMetadata(); + var overridden = new AvaloniaPropertyMetadata(); var target = new TestProperty("test", typeof(Class1), metadata); target.OverrideMetadata(overridden); @@ -66,9 +66,9 @@ namespace Avalonia.Base.UnitTests [Fact] public void OverrideMetadata_Should_Merge_Values() { - var metadata = new PropertyMetadata(BindingMode.TwoWay); + var metadata = new AvaloniaPropertyMetadata(BindingMode.TwoWay); var notify = (Action)((a, b) => { }); - var overridden = new PropertyMetadata(); + var overridden = new AvaloniaPropertyMetadata(); var target = new TestProperty("test", typeof(Class1), metadata); target.OverrideMetadata(overridden); @@ -129,19 +129,19 @@ namespace Avalonia.Base.UnitTests [Fact] public void PropertyMetadata_BindingMode_Default_Returns_OneWay() { - var data = new PropertyMetadata(defaultBindingMode: BindingMode.Default); + var data = new AvaloniaPropertyMetadata(defaultBindingMode: BindingMode.Default); Assert.Equal(BindingMode.OneWay, data.DefaultBindingMode); } private class TestProperty : AvaloniaProperty { - public TestProperty(string name, Type ownerType, PropertyMetadata metadata = null) - : base(name, ownerType, metadata ?? new PropertyMetadata()) + public TestProperty(string name, Type ownerType, AvaloniaPropertyMetadata metadata = null) + : base(name, ownerType, metadata ?? new AvaloniaPropertyMetadata()) { } - public void OverrideMetadata(PropertyMetadata metadata) + public void OverrideMetadata(AvaloniaPropertyMetadata metadata) { OverrideMetadata(typeof(T), metadata); }