Skip to content

fix null checks in KeyboardTypeConverter #30562

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 1 commit into
base: main
Choose a base branch
from

Conversation

SimonCropp
Copy link
Contributor

No description provided.

@Copilot Copilot AI review requested due to automatic review settings July 11, 2025 03:20
@SimonCropp SimonCropp requested a review from a team as a code owner July 11, 2025 03:20
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Jul 11, 2025
Copy link
Contributor

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

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 cleans up the null-check logic in the KeyboardTypeConverter, removing redundant checks and simplifying how reflection calls retrieve static fields and properties.

  • Removed unnecessary null checks around parts, since Split never returns null.
  • Dropped null-conditional operators on GetFields() and GetProperties() and simplified the conditional checks.
  • Streamlined matching logic for both static fields and properties.
Comments suppressed due to low confidence (2)

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

  • Add unit tests for both conversion formats (with and without the "Keyboard" prefix) to ensure these branches behave as expected after the cleanup.
				if (parts.Length == 1 || (parts.Length == 2 && parts[0] == "Keyboard"))

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

  • [nitpick] The variable name keyboard can be confused with the Keyboard type; consider renaming it to keyboardName or similar for clarity.
					string keyboard = parts[parts.Length - 1];

@rmarinho
Copy link
Member

What does this fix?

@SimonCropp
Copy link
Contributor Author

@rmarinho it remove redundant and misleading code

@rmarinho
Copy link
Member

/rebase

@github-actions github-actions bot force-pushed the fix-null-checks-in-KeyboardTypeConverter branch from 2facf5b to c22c5f0 Compare July 14, 2025 11:33
@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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants