maui
maui copied to clipboard
[regression/8.0.0-preview.4.8333] Line is not visible in .Net 8
Description
Have tried to add line using "Microsoft.Maui.Controls.Shapes.Line" in .Net 6 and checked the same scenario in .Net 8. But the line was not visible in .Net 8.
Sample DotNetEightUnderline.zip
Screenshot
.Net 6 :
.Net 8 :
Steps to Reproduce
- Run the attached sample.
- Now you can see the output.
Link to public reproduction project repository
https://github.com/shanmugasundar-sf3429/TextMarkupAnnotationVisibility
Version with bug
Is this a regression from previous behavior?
Yes
Last version that worked well
Affected platforms
iOS, Android, Windows, macOS, I was not able test on other platforms
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output
No response
I just noticed this with Rectangle on Windows; BackgroundColor doesn't seem to have an effect anymore, but if you set Fill then it works.
Edit: this is on latest public .NET 8 Preview. Edit 2: previously worked on latest .NET 7 for us 👍
Verified this on Visual Studio Enterprise 17.8.0 Preview 1.0. Repro on Windows 11(8.0.0-preview.7.8842), Android 13.0-API33 and iOS 16.4 with below Project: DotNetEightUnderline.zip
Confirmed that this regressed between 8.0.0-preview.4.8333 and 8.0.0-preview.3.8149. https://github.com/dotnet/maui/pull/14216 seems sus.
@jsuarezruiz
The issue is still there. with 8.0.6
Would you please fix this in upcoming release soon? We have Line
used at plenty of places in a very big project and we don't want to invest time to replace it with something else at those many places as a ugly workaround. This is time consuming for us.
Hope you would consider this for priority fix.
Thanks.
I don't know if it is a bug but I found this workaround
<Style TargetType="Line">
<Setter Property="Stroke" Value="DarkGray"/>
<Setter Property="X2" Value="{Binding Width, Source={RelativeSource Self}}" />
</Style>
When I set the Fill, BackgroundColour, HeightRequest, and WidthRequest, the line finally appears.
<Line HeightRequest="1" Fill="Red" WidthRequest="1000" BackgroundColor="Red"/>
Ok, few comments/questions here:
- Why is MAUI framework checking BackgroundColor and Fill, with AND operand?
- What exactly is overriding width/height with zeroes fixing? Lines aside, not specifying width/height is making other shapes (Rectangle for example) to not render. Making HorizontalOptions useless.
- Am I expected to go through all views, every time I update my MAUI version, just to check if my Lines (or something more important) suddenly has stopped rendering correctly. Or at all.
Those are not compile time exceptions. You do not get runtime exceptions either. One would think that after few years, the situation should get better, not worse. Those shapes were working in .NET 7.