Changing HeightRequest do not trigger SizeChanged on Android.
Description
The attached repo contains a simple custom control that shows a yellow box. The control's height is calculated based on its width, and the adjustment is made on its SizeChanged event listener. On iOS and Catalyst this works fine. On Android, it does't. Changes to HeightRequest do not re-trigger the event (nor updates the control size or visual). Not tested on other platforms.
Steps to Reproduce
- Clone the attached repo;
- Build and run on Android Emulator;
A yellow box should appear under the welcome message (but it doesn't). It should also print two messages to the Application Output Window, but only one will appear (cos SizeChanged will trigger only once). If you run on iOS Simulator or Catalyst, it will act accordingly, showing the yellow box and firing SizeChanged twice.
Link to public reproduction project repository
https://github.com/derlidio/HeightBug.git
Version with bug
8.0.0-rc.2.9511 Microsoft. Maui.Controls - 8.0.0-rc.2.9530 Microsoft.Maui.Controls.Compatibility - 8.0.0-rc.2.9530
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Tested on Pixel 3a API 32
Did you find any workaround?
No response
Relevant log output
No response
We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.
Verified this on Visual Studio Enterprise 17.8.0 Preview 7.0 using below Project (dotnet version is 8.0.100-rc.2.23502.2). Repro on Android 14.0-API34, not repro on Windows 11.
HeightBug-main.zip
Repro on Android 14.0-API34.
Not repro on Windows 11
Facing the same issue on iOS platform when visibility of child element is changed. This used to work in Xamarin.Forms. Tested on iPhone 14 Pro Max iOS 16.4
Hi @@derlidio. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.
You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.
This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
This issue is not reproducible on the latest .NET MAUI version 9.0.80 on Android. Additionally, the SizeChanged event is triggered twice. For your reference, I’ve attached a screenshot below.
Hi @@derlidio. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.
You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.
This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.