Skip to content

[Net 11] - Annotated remaining Converter classes for nullability - 3#30875

Open
NirmalKumarYuvaraj wants to merge 4 commits intodotnet:net11.0from
NirmalKumarYuvaraj:nullable-3
Open

[Net 11] - Annotated remaining Converter classes for nullability - 3#30875
NirmalKumarYuvaraj wants to merge 4 commits intodotnet:net11.0from
NirmalKumarYuvaraj:nullable-3

Conversation

@NirmalKumarYuvaraj
Copy link
Contributor

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

This pull request introduces significant updates to improve nullability annotations, refactor type converters, and enhance code readability in the Microsoft.Maui.Controls namespace. The changes primarily focus on enabling nullable reference types, refining type conversion logic, and modernizing the syntax.

Nullability Enhancements:

  • Enabled nullable reference types (#nullable enable) across several files, improving type safety and reducing potential null reference exceptions. [1] [2] [3] [4]

Type Converter Refactoring:

  • Refactored ConvertFrom and ConvertTo methods in multiple type converters to support nullable parameters and improve handling of edge cases. [1] [2] [3] [4]
  • Simplified logic for parsing and validating input strings in converters, ensuring consistent error handling and reducing complexity. [1] [2]

Syntax Modernization:

  • Replaced braces {} for single-line conditional statements with block formatting for better readability. [1] [2]
  • Updated namespace declarations to use the ; syntax instead of braces, aligning with modern C# conventions. [1] [2] [3]

Public API Updates:

  • Added overrides for CanConvertFrom, CanConvertTo, ConvertFrom, and ConvertTo methods in BindablePropertyConverter, ButtonContentTypeConverter, and other converters to the PublicAPI.Unshipped.txt file. This ensures the updated methods are documented as part of the public API.

These changes collectively improve maintainability, type safety, and adherence to modern C# practices in the Microsoft.Maui.Controls codebase.

Issues Fixed

Fixes #

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Jul 28, 2025
@dotnet-policy-service
Copy link
Contributor

Hey there @@NirmalKumarYuvaraj! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jul 28, 2025
@NirmalKumarYuvaraj NirmalKumarYuvaraj marked this pull request as ready for review July 28, 2025 12:57
Copilot AI review requested due to automatic review settings July 28, 2025 12:57
@NirmalKumarYuvaraj NirmalKumarYuvaraj requested a review from a team as a code owner July 28, 2025 12:57
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 pull request continues the series of updates to annotate remaining converter classes for nullability in the .NET MAUI Controls library. The changes focus on enabling nullable reference types and modernizing code syntax to improve type safety and code readability.

Key Changes:

  • Enables nullable reference types (#nullable enable) across multiple type converter classes
  • Updates method signatures in type converters to support nullable parameters
  • Modernizes code syntax with file-scoped namespaces and improved conditional statements

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
TextAlignment.cs Enabled nullability and modernized namespace declaration with improved conditional formatting
ShellSection.cs Updated type converter method signatures for nullable parameters
ShellNavigationState.cs Enabled nullability for ShellNavigationStateTypeConverter
ShellItem.cs Updated ShellItemConverter with nullable parameter support
ShellContent.cs Added nullability annotations to ShellContentConverter
StrokeShapeTypeConverter.cs Comprehensive refactoring with nullability, modernized syntax, and improved error handling
ResourceDictionary.cs Restructured RDSourceTypeConverter with nullable support and method reordering
FormattedString.cs Updated FormattedStringConverter with nullable annotations
FontAttributes.cs Enhanced FontAttributesConverter with nullability and improved conditional formatting
Button.cs Updated ButtonContentTypeConverter with nullable support
BindablePropertyConverter.cs Major refactoring with nullability enabled and method reorganization
PublicAPI files Added new public API entries for all updated converter method overrides

@jsuarezruiz
Copy link
Contributor

@NirmalKumarYuvaraj Could you rebase and fix the conflicts?

@NirmalKumarYuvaraj
Copy link
Contributor Author

@NirmalKumarYuvaraj Could you rebase and fix the conflicts?

@jsuarezruiz , I have rebased and resolved the conflicts. please let me know if you have any concerns.

@jsuarezruiz
Copy link
Contributor

@NirmalKumarYuvaraj Could you rebase and fix the conflicts? (Sorry, again!)

@NirmalKumarYuvaraj
Copy link
Contributor Author

@NirmalKumarYuvaraj Could you rebase and fix the conflicts? (Sorry, again!)

@jsuarezruiz , I have resolved the conflicts.

@rmarinho
Copy link
Member

needs rebase again sorry

@NirmalKumarYuvaraj
Copy link
Contributor Author

needs rebase again sorry

@rmarinho , rebased

@PureWeen
Copy link
Member

/azp run

@PureWeen PureWeen added this to the .NET 10.0-rc2 milestone Sep 18, 2025
@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen moved this from Todo to Ready To Review in MAUI SDK Ongoing Sep 18, 2025
@PureWeen
Copy link
Member

PureWeen commented Oct 6, 2025

/azp run

@PureWeen PureWeen modified the milestones: .NET 10.0-rc2, .NET 10.0 GA Oct 6, 2025
@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen modified the milestones: .NET 10 SR1, .NET 10.0 SR2 Nov 4, 2025
@PureWeen PureWeen modified the milestones: .NET 10.0 SR2, .NET 10 SR4 Dec 13, 2025
@PureWeen PureWeen modified the milestones: .NET 10.0 SR4, .NET 10 SR5 Jan 21, 2026
Copy link
Contributor

@kubaflo kubaflo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rebase and retarget to net 11 please?

@github-project-automation github-project-automation bot moved this from Ready To Review to Changes Requested in MAUI SDK Ongoing Feb 15, 2026
@NirmalKumarYuvaraj NirmalKumarYuvaraj changed the base branch from net10.0 to net11.0 February 16, 2026 08:50
@NirmalKumarYuvaraj
Copy link
Contributor Author

@kubaflo , Updated the changes

@MauiBot
Copy link
Collaborator

MauiBot commented Mar 22, 2026

⚠️ Merge Conflict Detected — This PR has merge conflicts with its target branch. Please rebase onto the target branch and resolve the conflicts.

Copy link
Contributor

@kubaflo kubaflo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please resolve conflicts?

@MauiBot
Copy link
Collaborator

MauiBot commented Mar 26, 2026

⚠️ Merge Conflict Detected — This PR has merge conflicts with its target branch. Please rebase onto the target branch and resolve the conflicts.

@Tamilarasan-Paranthaman Tamilarasan-Paranthaman changed the title [Net 10] - Annotated remaining Converter classes for nullability - 3 [Net 11] - Annotated remaining Converter classes for nullability - 3 Mar 26, 2026
@github-actions
Copy link
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 30875

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 30875"

@github-project-automation github-project-automation bot moved this from Changes Requested to Approved in MAUI SDK Ongoing Mar 26, 2026
@kubaflo
Copy link
Contributor

kubaflo commented Mar 26, 2026

@jfversluis could you take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration

Projects

Status: Approved

Development

Successfully merging this pull request may close these issues.

10 participants