maui
maui copied to clipboard
MainDisplayInfo reports page size instead of screen size in .net 8
Description
After upgrading to .net 8, DeviceDisplay.Current.MainDisplayInfo is reporting the page height and width instead of the screen. If you get the height and divide it by the density on an iPhone 15 pro, it reports 852 which is the same size as the page. In .net 7, it reported the actual screen size. Which is what I would expect from MainDisplayInfo.Height - rather than the useable space.
Ideally, I could get either the actual display height or the page height. It would also be nice to get the height of the bottom and top gutters individually.
However, the main issue is that this reported one number in .net 7 and a different number in .net 8 and I don't have a clear solution for getting the actual screen height.
Steps to Reproduce
Call DeviceDisplay.Current.MainDisplayInfo.Height and compare it to the height of the page.
var pageHeight = this.Height;
var screenHeight = DeviceDisplay.Current.MainDisplayInfo.Height / DeviceDisplay.Current.MainDisplayInfo.Density;
var screenHeight2 = DeviceDisplay.MainDisplayInfo.Height / DeviceDisplay.MainDisplayInfo.Density;
Console.WriteLine(pageHeight == screenHeight && pageHeight == screenHeight2);
Link to public reproduction project repository
No response
Version with bug
8.0.3
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
7.0.101
Affected platforms
iOS, I was not able test on other platforms
Affected platform versions
iOS 15
Did you find any workaround?
Not really, no. I can't easily get the size of the top and bottom gutter and the navigation bar. If I could get those, I could do the math myself.
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.