Skip to content

TestMethodIdentifierProperty *TypeFullName is not nullable #5734

Open
@thomhurst

Description

@thomhurst

When specifying TypeFullNames in the TestMethodIdentifier, it expects non-null type names.

However, Type.FullName is a nullable property.

I actually didn't know when it could be null, so asked co-pilot and was told:

Type.FullName can be null for certain types in .NET, such as:
  • Generic type parameters (e.g., T in List)
  • Array types of generic parameters
  • Open generic types (e.g., typeof(List<>))
  • Dynamic types or types created at runtime without a full name

This is by design in the .NET type system. Always check for null when using Type.FullName to avoid NullReferenceException

Given this is a possibility for tests (because users end up specifying params, who knows what they'll put in there.), should these not be nullable?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions