Skip to content
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

Consider changing TypeDescriptor.GetTypeDescriptor to return EmptyCustomTypeDescriptor instead of null #55176

Open
krwq opened this issue Jul 5, 2021 · 1 comment

Comments

@krwq
Copy link
Member

krwq commented Jul 5, 2021

Found during adding nullable annotations to TypeConverter (#54961)

Currently TypeDescriptor.GetTypeDescriptor returns null when instance is null.

Consider changing that logic to return EmptyCustomTypeDescriptor and changing nullability of return type.

Current logic causes that GetTypeDescriptor needs to return nullable ICustomTypeDescriptor which causes that base class needs to be annotated the same which adds lots of unnecessary !. Returning EmptyCustomTypeDescriptor seems more consistent with other implementations though and also seems no code in the framework expects that API to return null.

Please make sure to track usages and remove unnecessary ! along the way when fixing this

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Jul 5, 2021
@ghost
Copy link

ghost commented Jul 5, 2021

Tagging subscribers to this area: @safern
See info in area-owners.md if you want to be subscribed.

Issue Details

Found during adding nullable annotations to TypeConverter (#54961)

Currently TypeDescriptor.GetTypeDescriptor returns null when instance is null.

Consider changing that logic to return EmptyCustomTypeDescriptor and changing nullability of return type.

Current logic causes that GetTypeDescriptor needs to return nullable ICustomTypeDescriptor which causes that base class needs to be annotated the same which adds lots of unnecessary !. Returning EmptyCustomTypeDescriptor seems more consistent with other implementations though and also seems no code in the framework expects that API to return null.

Author: krwq
Assignees: -
Labels:

area-System.ComponentModel

Milestone: -

@safern safern added this to the Future milestone Jul 22, 2021
@safern safern removed the untriaged New issue has not been triaged by the area owner label Jul 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants