I have the following interface that needs to get implemented, returning default if not finding the role generates warning CS8603 Possible null reference return.
public async Task<ApplicationRole> FindRoleByIdAsync(string roleId, CancellationToken cancellationToken = default)
{
//find the role based on ID return it if found else
return default;
}
I can't change the interface and make it nullable as my influence over Microsoft are not at that level... so I guess update it with an annotation (does not make the warning go away)
[return: MaybeNull]
public async Task<ApplicationRole> FindRoleByIdAsync(string roleId, CancellationToken cancellationToken = default)
{
//find the role based on ID return it if found.. else
return default;
}
what is the correct way to implement this, any suggestions?