Skip to content

[regression/8.0.0] Windows and Android no longer draw Borders/clipping correctly (previously was okay) #18071

Open

Description

Description

I posted a bug report here regarding .NET 7 iOS not rendering Borders and clipping masks correctly: #17998

I was suggested to try .NET 8 and .NET 8 did fix this in iOS but it has now broken it in Android and Windows.

CORRECT BEHAVIOR:
Here is the correct behavior from .NET 7 Android and also now seen with .NET 8 iOS:
ios border mask bug 2

ABNORMAL BEHAVIOR:
Here is what Windows .NET 8 is now doing (the same thing iOS used to do):
windows border alignment bug

Here is what Android .NET 8 is now doing (new abnormal behavior):
ios border mask bug android 8

So this problem was fixed in iOS from .NET 7 to .NET 8. But it is now broken in Windows and Android, whereas in .NET 7 Windows and Android worked fine.

A unified fix please would be very appreciated, as this function is very basically essential.

Steps to Reproduce

Open bug project, play in various platforms and versions, observe the various behaviors.

Working:

  • .NET 7 Windows, .NET 7 Android, .NET 8 iOS

Broken:

  • .NET 8 Windows, .NET 8 Android, .NET 7 iOS

Link to public reproduction project repository

https://github.com/jonmdev/Border-iOS-Mask-Bug

Repro Code

Replace app.xaml.cs with:

using Microsoft.Maui.Controls.Shapes;

namespace Border_iOS_Mask_Bug {
    public partial class App : Application {
        public App() {
            InitializeComponent();

            ContentPage mainPage = new();
            mainPage.BackgroundColor = Colors.CornflowerBlue;
            this.MainPage = mainPage;

            VerticalStackLayout vert = new();
            mainPage.Content = vert;

            Border border = new();
            border.Stroke = Colors.White;
            border.StrokeThickness = 10;
            //border.Shadow = new Shadow() { Offset = new Point(0, 6), Radius = 7 };
            vert.Add(border);

            AbsoluteLayout abs = new();
            border.Content = abs;

            Image image = new();
            abs.Add(image);
            image.Source = ImageSource.FromResource("Border_iOS_Mask_Bug.Resources.Images.cat.jpg");
            image.Aspect = Aspect.AspectFill;

            //resize function
            mainPage.SizeChanged += delegate {
                if (mainPage.Width > 0) {
                    int width = (int)mainPage.Width ;
                    border.WidthRequest = border.HeightRequest = width * 0.5;
                    image.WidthRequest = image.HeightRequest = width * 0.5;
                    border.StrokeShape = new RoundRectangle() { CornerRadius = width * 0.25 };
                }
            };
        }
    }
}

Version with bug

8.0.0-rc.1.9171

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

7.0.96

Affected platforms

Android, Windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions