Skip to content

Commit 688b7de

Browse files
authored
Fix nullability of TypeNameHelper.GetTypeDisplayName parameter (#30987)
1 parent 54d04c5 commit 688b7de

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Shared/TypeNameHelper/TypeNameHelper.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System;
55
using System.Text;
66
using System.Collections.Generic;
7+
using System.Diagnostics.CodeAnalysis;
78

89
#nullable enable
910

@@ -33,7 +34,8 @@ internal static class TypeNameHelper
3334
{ typeof(ushort), "ushort" }
3435
};
3536

36-
public static string? GetTypeDisplayName(object item, bool fullName = true)
37+
[return: NotNullIfNotNull("item")]
38+
public static string? GetTypeDisplayName(object? item, bool fullName = true)
3739
{
3840
return item == null ? null : GetTypeDisplayName(item.GetType(), fullName);
3941
}

0 commit comments

Comments
 (0)