Skip to content

Annotated remaining Converter classes for nullability#30573

Merged
rmarinho merged 2 commits into
dotnet:net10.0from
NirmalKumarYuvaraj:fix-28860
Jul 16, 2025
Merged

Annotated remaining Converter classes for nullability#30573
rmarinho merged 2 commits into
dotnet:net10.0from
NirmalKumarYuvaraj:fix-28860

Conversation

@NirmalKumarYuvaraj

Copy link
Copy Markdown
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 updates multiple type converters across the codebase to improve nullability handling, enhance error handling, and ensure compliance with modern C# standards. The changes primarily involve adding nullable annotations, refining method implementations, and improving readability and maintainability.

Nullability Enhancements:

Error Handling Improvements:

Codebase Cleanup:

Issues Fixed

Fixes #28860

@dotnet-policy-service

Copy link
Copy Markdown
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 community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration labels Jul 11, 2025
@NirmalKumarYuvaraj NirmalKumarYuvaraj marked this pull request as ready for review July 11, 2025 13:02
Copilot AI review requested due to automatic review settings July 11, 2025 13:02
@NirmalKumarYuvaraj NirmalKumarYuvaraj requested a review from a team as a code owner July 11, 2025 13:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 annotates the remaining converter classes with nullable reference types, improves error handling for invalid inputs, and updates public API signatures across all frameworks.

  • Updated converter method signatures in ThicknessTypeConverter, KeyboardTypeConverter, FlexEnumsConverters, and EasingTypeConverter to use nullable annotations.
  • Enhanced parsing logic with null checks and explicit exceptions for unsupported or malformed values.
  • Updated PublicAPI.Unshipped.txt entries to expose new nullable overloads for converter methods.

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Core/src/Converters/ThicknessTypeConverter.cs Added nullable annotations to signatures and improved parsing error paths.
src/Core/src/Converters/PrimitiveTypeConversions.cs Removed unnecessary #nullable enable directive.
src/Core/src/Converters/KeyboardTypeConverter.cs Refined null guards, updated signature, and improved ConvertTo error logic.
src/Core/src/Converters/FlexEnumsConverters.cs Applied nullable annotations and refined enum parsing in all converters.
src/Core/src/Converters/EasingTypeConverter.cs Introduced null handling in ConvertFrom and updated nullable signatures.
src/Core/src/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt Exposed new nullable converter overloads in the public API surface.
Comments suppressed due to low confidence (3)

src/Core/src/Converters/KeyboardTypeConverter.cs:48

  • [nitpick] The long sequence of if checks for each Keyboard value is repetitive; consider using a switch expression or a lookup dictionary to improve readability and reduce maintenance overhead.
		public override object ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType)

src/Core/src/Converters/EasingTypeConverter.cs:19

  • [nitpick] New behavior returns null for a null or whitespace input; please add unit tests to cover these null-returning scenarios and ensure they behave as expected.
			if (value is null)

public class ThicknessTypeConverter : TypeConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType)

Copilot AI Jul 11, 2025

Copy link

Choose a reason for hiding this comment

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

Updating the signature of a public override is a breaking change; please confirm that introducing a nullable context parameter in a patch/minor release is intended.

Copilot uses AI. Check for mistakes.
@rmarinho

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

@rmarinho rmarinho left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Failing test not related

@github-project-automation github-project-automation Bot moved this from Todo to Approved in MAUI SDK Ongoing Jul 16, 2025
@rmarinho rmarinho merged commit 3ee6e19 into dotnet:net10.0 Jul 16, 2025
127 of 129 checks passed
@github-project-automation github-project-automation Bot moved this from Approved to Done in MAUI SDK Ongoing Jul 16, 2025
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants