title: What is the criteria for showing a dereference of a possible null reference warning?
body: <p>I have a QueryExecutor file in my onion microservice architecture, and I get a dereference of a possibly null reference warning in code bellow:</p>
  <pre class="lang-cs prettyprint-override"><code>public async Task&lt;IReadOnlyCollection&lt;T&gt;&gt; GetAll&lt;T&gt;() where T : BaseEntity
      =&gt; await _mongoDbContext.GetCollection&lt;T&gt;()
                              .Find(_ =&gt; true).ToListAsync();
  
  public async Task UpdateAsync&lt;T&gt;(FilterDefinition&lt;T&gt; filterDefinition, UpdateDefinition&lt;T&gt; updateDefinition) where T : BaseEntity
      =&gt; await _mongoDbContext.GetCollection&lt;T&gt;()
                              .UpdateOneAsync(filterDefinition, updateDefinition);
  </code></pre>
  <p>Only the Update method gives the warning and I think I understand it - the mongoDbContext.GetCollection() could return a null value. But what I don't understand is why doesn't the GetAll method return it as well. The only difference I see is that Update return value is a void Task and Update has a read only collection.</p>