Skip to content

Conversation

@jfversluis
Copy link
Member

@jfversluis jfversluis commented May 27, 2025

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

  • Adds the Obsolete attribute to the TextType.Html property in the Label class to mark it as obsolete.
  • Suppress the build warnings/errors for usages of this in our own codebase

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...)

Copilot AI review requested due to automatic review settings May 27, 2025 08:06
@jfversluis jfversluis requested a review from a team as a code owner May 27, 2025 08:06
@jfversluis jfversluis requested review from PureWeen and rmarinho May 27, 2025 08:06
@dotnet-policy-service
Copy link
Contributor

🚨 API change(s) detected @davidbritch FYI

@dotnet-policy-service
Copy link
Contributor

🚨 API change(s) detected @davidortinau @rachelkang FYI

Copy link
Contributor

Copilot AI left a 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 to TextType.Html in TextType.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

{
var label = new LabelStub()
{
#pragma warning disable CS0612 // Type or member is obsolete
Copy link

Copilot AI May 27, 2025

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.
@mattleibow
Copy link
Member

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.

Copy link
Contributor

@jsuarezruiz jsuarezruiz left a 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)

@rmarinho rmarinho added the do-not-merge Don't merge this PR label May 30, 2025
@rmarinho rmarinho added this to the .NET 10.0-preview6 milestone May 30, 2025
@jfversluis jfversluis force-pushed the obsolete-html-texttype branch from c4825d7 to 0eda463 Compare June 4, 2025 13:47
@PureWeen PureWeen marked this pull request as draft June 4, 2025 14:07
@PureWeen
Copy link
Member

PureWeen commented Jun 4, 2025

@jfversluis can you review through a set of open issues and determine out many of them can be solved by WebView and get a sense of how disruptive this might be.

@jfversluis
Copy link
Member Author

Lets do this at a later stage

@jfversluis jfversluis closed this Jun 11, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Jul 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants