According to this documentation I can decorate a method with NotNullIfNotNull attribute. However the following code does not work:
using System.Diagnostics.CodeAnalysis;
var a = await Test("abc");
Console.WriteLine(a.Length);
[return: NotNullIfNotNull(nameof(input))]
static async Task<string?> Test(string? input)
{
return await Task.FromResult(input);
}
I still receives a warning at a.Length (Dereference of a possibly null reference):
I suspect I can confirm the issue only happen to Task is causing this issue.async (returning Task) methods. How should I fix this problem?

Task<T>, notT.