Skip to content

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

Description

@krwq

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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions