-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Obsolete TextType.Html
for .NET 10
#29685
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
base: net10.0
Are you sure you want to change the base?
Conversation
🚨 API change(s) detected @davidbritch FYI |
🚨 API change(s) detected @davidortinau @rachelkang FYI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR marks the TextType.Html
enum member as obsolete and suppresses the resulting compiler warnings across the codebase.
- Adds
[Obsolete]
attribute toTextType.Html
inTextType.cs
- Wraps usages of
TextType.Html
in#pragma warning disable/restore
to keep builds warning-free - Updates various test and platform extension files to suppress CS0612 warnings
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
src/Core/tests/DeviceTests/Handlers/Label/LabelHandlerTests.cs | Suppress obsolete warning in handler test |
src/Core/src/Primitives/TextType.cs | Mark TextType.Html as obsolete |
src/Controls/tests/TestCases.HostApp/Issues/XFIssue/LabelTextType.cs | Suppress obsolete warning in HostApp test |
src/Controls/tests/TestCases.HostApp/Issues/Issue8870.cs | Suppress obsolete warning in HostApp test |
src/Controls/tests/TestCases.HostApp/Issues/Issue21711.cs | Suppress obsolete warning in HostApp test |
src/Controls/tests/TestCases.HostApp/Issues/CarouselViewSetOrientation.cs | Suppress obsolete warning in HostApp test |
src/Controls/tests/TestCases.HostApp/Elements/LabelCoreGalleryPage.cs | Suppress obsolete warning in gallery page |
src/Controls/tests/DeviceTests/Elements/Label/LabelTests.iOS.cs | Suppress obsolete warning in iOS device test |
src/Controls/tests/DeviceTests/Elements/Label/LabelTests.cs | Suppress obsolete warning in device test |
src/Controls/tests/DeviceTests/Elements/Label/LabelTests.Android.cs | Suppress obsolete warning in Android device test |
src/Controls/src/Core/Platform/iOS/Extensions/LabelExtensions.cs | Suppress obsolete warning in iOS extension |
src/Controls/src/Core/Platform/iOS/Extensions/FormattedStringExtensions.cs | Suppress obsolete warning in formatted-string extension |
src/Controls/src/Core/Platform/Android/Extensions/TextViewExtensions.cs | Suppress obsolete warning in Android extension |
src/Controls/src/Core/Label/Label.iOS.cs | Suppress obsolete warning in iOS mapper |
@@ -17,5 +17,6 @@ public enum TextType | |||
/// The subset of supported HTML tags varies by platform. Each platform's native text rendering engine | |||
/// determines which HTML tags and attributes are supported. | |||
/// </remarks> | |||
[System.Obsolete] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider providing a message in the Obsolete attribute to guide developers on migration or alternative APIs (e.g., [Obsolete("Use CustomHtmlLabel instead.")]
).
[System.Obsolete] | |
[System.Obsolete("The Html value is deprecated. Use Markdown or another supported format for rich text content.")] |
Copilot uses AI. Check for mistakes.
@@ -17,5 +17,6 @@ public enum TextType | |||
/// The subset of supported HTML tags varies by platform. Each platform's native text rendering engine | |||
/// determines which HTML tags and attributes are supported. | |||
/// </remarks> | |||
[System.Obsolete] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the public XML documentation under /docs/
to reflect that TextType.Html
is now obsolete and document the planned replacement or removal.
Copilot uses AI. Check for mistakes.
@@ -303,7 +303,9 @@ public async Task HtmlTextInitializesCorrectly() | |||
{ | |||
var label = new LabelStub() | |||
{ | |||
#pragma warning disable CS0612 // Type or member is obsolete |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The inline #pragma warning
directives add clutter to test code; consider using a global suppression file (e.g., GlobalSuppressions.cs
) to clean up repeated suppressions.
Copilot uses AI. Check for mistakes.
@@ -17,5 +17,6 @@ public enum TextType | |||
/// The subset of supported HTML tags varies by platform. Each platform's native text rendering engine | |||
/// determines which HTML tags and attributes are supported. | |||
/// </remarks> | |||
[System.Obsolete] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding the Obsolete attribute to the public TextType.Html
enum member changes the public API and may be considered a breaking change; please confirm this aligns with your versioning policy.
Copilot uses AI. Check for mistakes.
I would also obsolete the TextType. We probably can use some converter for the HTML to FormattedString or Markdown to FormattedString. This could live in the MCT. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending changes in LabelExtensions:
C:\a\_work\1\s\src\Compatibility\Core\src\iOS\Extensions\LabelExtensions.cs(28,28): error CS0612: 'TextType.Html' is obsolete [C:\a\_work\1\s\src\Compatibility\Core\src\Compatibility.csproj::TargetFramework=net10.0-maccatalyst18.4]
C:\a\_work\1\s\src\Controls\src\Core\Platform\Windows\Extensions\TextBlockExtensions.cs(29,10): error CS0612: 'TextType.Html' is obsolete [C:\a\_work\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net10.0-windows10.0.19041.0]
C:\a\_work\1\s\src\Compatibility\Core\src\iOS\Extensions\LabelExtensions.cs(28,28): error CS0612: 'TextType.Html' is obsolete [C:\a\_work\1\s\src\Compatibility\Core\src\Compatibility.csproj::TargetFramework=net10.0-ios18.4]
C:\Users\cloudtest\.nuget\packages\microsoft.windowsappsdk\1.7.250401001\buildTransitive\Microsoft.UI.Xaml.Markup.Compiler.interop.targets(845,9): error MSB3073: The command ""C:\Users\cloudtest\.nuget\packages\microsoft.windowsappsdk\1.7.250401001\buildTransitive\..\tools\net6.0\..\net472\XamlCompiler.exe" "C:\a\_work\1\s\artifacts\obj\Controls.Core\Release\net10.0-windows10.0.19041.0\\input.json" "C:\a\_work\1\s\artifacts\obj\Controls.Core\Release\net10.0-windows10.0.19041.0\\output.json"" exited with code 1. [C:\a\_work\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net10.0-windows10.0.19041.0]
C:\a\_work\1\s\src\Controls\src\Core\Platform\Windows\Extensions\TextBlockExtensions.cs(29,10): error CS0612: 'TextType.Html' is obsolete [C:\a\_work\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net10.0-windows10.0.20348.0]
C:\Users\cloudtest\.nuget\packages\microsoft.windowsappsdk\1.7.250401001\buildTransitive\Microsoft.UI.Xaml.Markup.Compiler.interop.targets(845,9): error MSB3073: The command ""C:\Users\cloudtest\.nuget\packages\microsoft.windowsappsdk\1.7.250401001\buildTransitive\..\tools\net6.0\..\net472\XamlCompiler.exe" "C:\a\_work\1\s\artifacts\obj\Controls.Core\Release\net10.0-windows10.0.20348.0\\input.json" "C:\a\_work\1\s\artifacts\obj\Controls.Core\Release\net10.0-windows10.0.20348.0\\output.json"" exited with code 1. [C:\a\_work\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net10.0-windows10.0.20348.0]
6 Error(s)
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description of Change
Obsolete
attribute to theTextType.Html
property in theLabel
class to mark it as obsolete.The HTML text type is a headache. Different platforms support different things, and its not very stable across all platforms. If (note: if) we would want to keep this, I would want to move this into its own control and not combine it with the regular
Label
. Or we might just get rid of this entirely.Q: Should we then also obsolete the
Label.TextType
property? Since it has no use if we remove the HTML option.(Mostly a proposal at this point, but might become a real thing...)