Skip to content

Commit

Permalink
chore: Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 committed Feb 16, 2024
1 parent 76d841a commit 2544755
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Uno.UI.Composition/Composition/CompositionObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Numerics;
using System.Runtime.CompilerServices;
using Microsoft.UI.Dispatching;
using Uno.Foundation.Logging;
using Windows.Foundation.Metadata;
using Windows.UI;
using Windows.UI.Core;
Expand Down Expand Up @@ -70,7 +71,20 @@ public void StartAnimation(string propertyName, CompositionAnimation animation)
_animations[propertyName] = animation;
animation.PropertyChanged += ReEvaluateAnimation;
var animationValue = animation.Start();
this.SetAnimatableProperty(propertyName, animationValue);

try
{
this.SetAnimatableProperty(propertyName, animationValue);
}
catch (Exception ex)
{
// Important to catch the exception.
// It can currently happen for non-implemented animations which will evaluate to null and the target animation property is value type.
if (this.Log().IsEnabled(LogLevel.Error))
{
this.Log().LogError($"An exception occurred while setting animation value '{animationValue}' to property '{propertyName}' for animation '{animation}'. {ex.Message}");
}
}
}

private void ReEvaluateAnimation(CompositionAnimation animation)
Expand Down

0 comments on commit 2544755

Please sign in to comment.