Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting a Label of TextType HTML with encoded HTML causes crash. #13319

Closed
drasticactions opened this issue Feb 14, 2023 · 2 comments · Fixed by #11409
Closed

Setting a Label of TextType HTML with encoded HTML causes crash. #13319

drasticactions opened this issue Feb 14, 2023 · 2 comments · Fixed by #11409
Labels
area-controls-label Label, Span fixed-in-8.0.0-preview.1.7762 Look for this fix in 8.0.0-preview.1.7762! platform/windows 🪟 t/bug Something isn't working

Comments

@drasticactions
Copy link
Contributor

drasticactions commented Feb 14, 2023

Description

Label supports HTML via the TextType HTML

Ex.

<Label TextType="Html" x:Name="TestLabel" />

This should render text that uses HTML to be rendered as native elements. However, if your HTML string includes HTML Encoded elements (Ex. &nbsp;) it blows up on a System.Text.Xml exception:

image

This causes a hard crash.

Steps to Reproduce

  1. Create a Label with TextType HTML
  2. Set it to a string that has HTML encoded elements in it.
  3. Run it.

Link to public reproduction project repository

https://github.com/drasticactions/MauiRepros/tree/main/MauiHtmlLabelBug

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

All Platforms.

Did you find any workaround?

Decode the text yourself before setting it to the string with a Converter... although if you're already decoding the text, using the text type is kinda useless.

Relevant log output

>	Microsoft.Maui.dll!Microsoft.Maui.Platform.TextBlockExtensions.UpdateTextHtml(Microsoft.UI.Xaml.Controls.TextBlock platformControl, Microsoft.Maui.ILabel label) 行 114	C#
@drasticactions drasticactions added the t/bug Something isn't working label Feb 14, 2023
@drasticactions drasticactions changed the title Encoded HTML for Label using TextType HTML causes hard crash. Setting a Label of TextType HTML with HTML causes crash. Feb 14, 2023
@drasticactions drasticactions changed the title Setting a Label of TextType HTML with HTML causes crash. Setting a Label of TextType HTML with encoded HTML causes crash. Feb 14, 2023
@jsuarezruiz jsuarezruiz added the area-controls-label Label, Span label Feb 14, 2023
@ghost ghost added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Feb 14, 2023
@drasticactions
Copy link
Contributor Author

@drasticactions
Copy link
Contributor Author

And I'm closing this as it's a dupe of #11409

@ghost ghost locked as resolved and limited conversation to collaborators Mar 16, 2023
@samhouts samhouts added the fixed-in-8.0.0-preview.1.7762 Look for this fix in 8.0.0-preview.1.7762! label May 10, 2023
@samhouts samhouts added this to the .NET 8 + Servicing milestone Sep 19, 2023
@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-label Label, Span fixed-in-8.0.0-preview.1.7762 Look for this fix in 8.0.0-preview.1.7762! platform/windows 🪟 t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants