Skip to content

Annotated remaining Converter classes for nullability #30573

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

Open
wants to merge 2 commits into
base: net10.0
Choose a base branch
from

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

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 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 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
Copy link
Contributor

@Copilot 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 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)

/// <inheritdoc/>
public class ThicknessTypeConverter : TypeConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType)
Copy link
Preview

Copilot AI Jul 11, 2025

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
Member

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

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
None yet
Development

Successfully merging this pull request may close these issues.

2 participants