The problem is the wait. The nullable value occurs before waiting, so it likes await (this.repository?.Exists(id)) , which when this.repository is null, turns into await (null?.Exists(id)) , which turns into await (null) , which crashes .. cannot get into Task<bool> and make it Task<bool?> .
This way you will either get the correct boolean value or an exception.
source share