Skip to content

Commit 9e045fa

Browse files
committed
Fixed unwanted capture in lambda expression
1 parent 7c090e7 commit 9e045fa

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Microsoft.Toolkit/Extensions/TypeExtensions.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ static string FormatDisplayString(Type type, int genericTypeOffset, ReadOnlySpan
159159
// By-ref types are displayed as T&
160160
if (t.IsByRef)
161161
{
162-
t = t.GetElementType();
162+
t = t.GetElementType()!;
163163

164-
return $"{FormatDisplayString(t, 0, type.GetGenericArguments())}&";
164+
return $"{FormatDisplayString(t, 0, t.GetGenericArguments())}&";
165165
}
166166

167167
// Pointer types are displayed as T*
@@ -173,14 +173,14 @@ static string FormatDisplayString(Type type, int genericTypeOffset, ReadOnlySpan
173173
while (t.IsPointer)
174174
{
175175
depth++;
176-
t = t.GetElementType();
176+
t = t.GetElementType()!;
177177
}
178178

179-
return $"{FormatDisplayString(t, 0, type.GetGenericArguments())}{new string('*', depth)}";
179+
return $"{FormatDisplayString(t, 0, t.GetGenericArguments())}{new string('*', depth)}";
180180
}
181181

182182
// Standard path for concrete types
183-
return FormatDisplayString(t, 0, type.GetGenericArguments());
183+
return FormatDisplayString(t, 0, t.GetGenericArguments());
184184
});
185185
}
186186

0 commit comments

Comments
 (0)