Browse Source

Don't disallow setting unregistered properties.

The changes made to the animation system in #1768 currently needs to be able to set any property on any object in order for animations on transforms to work.
Steven Kirk 7 years ago
parent
commit
62526bef35

+ 8 - 1
src/Markup/Avalonia.Markup.Xaml/Converters/AvaloniaPropertyTypeConverter.cs

@@ -5,6 +5,7 @@ using System;
 using System.ComponentModel;
 using System.Globalization;
 using Avalonia.Controls;
+using Avalonia.Logging;
 using Avalonia.Markup.Parsers;
 using Avalonia.Markup.Xaml.Parsers;
 using Avalonia.Markup.Xaml.Templates;
@@ -42,7 +43,13 @@ namespace Avalonia.Markup.Xaml.Converters
                 !property.IsAttached &&
                 !registry.IsRegistered(targetType, property))
             {
-                throw new XamlLoadException($"Property '{effectiveOwner.Name}.{propertyName}' is not registered on '{targetType}'.");
+                Logger.Warning(
+                    LogArea.Property,
+                    this,
+                    "Property '{Owner}.{Name}' is not registered on '{Type}'.",
+                    effectiveOwner,
+                    propertyName,
+                    targetType);
             }
 
             return property;

+ 1 - 1
tests/Avalonia.Markup.Xaml.UnitTests/Xaml/StyleTests.cs

@@ -174,7 +174,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml
             }
         }
 
-        [Fact]
+        [Fact(Skip = "The animation system currently needs to be able to set any property on any object")]
         public void Disallows_Setting_Non_Registered_Property()
         {
             using (UnitTestApplication.Start(TestServices.StyledWindow))