'Deference of a possibly null reference

public async Task<User> GetUserByIdAsync(int id)
    {
        return await myAppDbContext.tbl_User.FindAsync(id);
    }

myAppDbContext is not null here, Possible null reference return.

Constructor :

private readonly MyAppDbContext myAppDbContext;

    public UserRepository(MyAppDbContext myAppDbContext)
    {
        this.myAppDbContext = myAppDbContext;
    }

How do we get rid of this warning. I tried adding question mark after MyAppDbContext?. Googled, but not many helpful answers.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source