Skip to content

Commit

Permalink
fix: Use FallbackColor for unsupported brushes
Browse files Browse the repository at this point in the history
Previously we have thrown Application.UnhandledException when an unsupported brush was used, even though we still had FallbackColorWithOpacity available
  • Loading branch information
MartinZikmund committed Sep 10, 2024
1 parent 9f22ee9 commit ed9db19
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Uno.UI/UI/Xaml/Shapes/Shape.iOSmacOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,15 @@ private void SetFillAndStroke(CAShapeLayer pathLayer)
fillColor = Colors.Transparent;
break;

case XamlCompositionBrushBase compositionBrush: // Use Fallback for unsupported brushes
fillColor = compositionBrush.FallbackColorWithOpacity;
break;

default:
Application.Current.RaiseRecoverableUnhandledException(new NotSupportedException($"The brush {Fill} is not supported as Fill for a {this} on this platform."));
if (this.Log().IsEnabled(LogLevel.Warning))
{
this.Log().LogWarning($"The brush {Fill} is not supported as Fill for a {this} on this platform.");
}
fillColor = Colors.Transparent;
break;
}
Expand Down

0 comments on commit ed9db19

Please sign in to comment.