title: How to fix 'AspNetCore.Views_Home_Index.ExecuteAsync()' NullReference error in MVC
body: <p>I'm setting up a simple ASP.NET Core MVC project that includes some partial views that I want to be rendered asynchronously. But it seems that, regardless whether they are rendered asynchronously or not I keep getting the same <code>ExecuteAsync()</code> NullReferenceException error.</p>
  
  <p>I have checked all the models and the HTML code but it doesn't seem to work either way, always returning:</p>
  
  <blockquote>
    <p>An unhandled exception occurred while processing the request.
    NullReferenceException: Object reference not set to an instance of an
    object. AspNetCore.Views_Home_Index.ExecuteAsync() in Index.cshtml,
    line 4.</p>
  </blockquote>
  
  <p>Index.cshtml:</p>
  
  <pre class="lang-html prettyprint-override"><code>@using BestDeal.ViewModels
  @model HomeViewModel
  
  @await Html.PartialAsync("ArtikalCarouselPocetna")
  
  &lt;h2&gt;Istaknuti artikli&lt;/h2&gt;
  &lt;div class="row"&gt;
      @foreach (var artikal in Model.odabraniArtikli)
      {
          @Html.Partial("ArtikalPregled", artikal)
      }
  &lt;/div&gt;
  </code></pre>
  
  <p>ArtikalCarouselPocetna partial view:</p>
  
  <pre class="lang-html prettyprint-override"><code>
  &lt;div class="row carousel-holder marginTop1"&gt;
      &lt;div class="col-md-12"&gt;
          &lt;div id="carousel-example-generic" class="carousel slide" data-ride="carousel"&gt;
              &lt;ol class="carousel-indicators"&gt;
                  &lt;li data-target="#carousel-example-generic" data-slide-to="0" class="active"&gt;&lt;/li&gt;
                  &lt;li data-target="#carousel-example-generic" data-slide-to="1"&gt;&lt;/li&gt;
                  &lt;li data-target="#carousel-example-generic" data-slide-to="2"&gt;&lt;/li&gt;
              &lt;/ol&gt;
              &lt;div class="carousel-inner"&gt;
                  &lt;div class="item active"&gt;
                      &lt;img class="slide-image" src="https://images-na.ssl-images-amazon.com/images/I/71t-J3VJtEL._SX425_.jpg" alt=""&gt;
                  &lt;/div&gt;
                  &lt;div class="item"&gt;
                      &lt;img class="slide-image" src="https://zdnet1.cbsistatic.com/hub/i/r/2019/04/17/1f68c3a6-495e-4325-bc16-cc531812f0ec/thumbnail/770x433/84ff4194826e8303efb771cd377a854f/chuwi-herobook-header.jpg" alt=""&gt;
                  &lt;/div&gt;
                  &lt;div class="item"&gt;
                      &lt;img class="slide-image" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRKRl7BqXfZupIBH4N8i-tD45gVPctFV5jKTeTmOIADFhZ8J_DAYQ" alt=""&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;a class="left carousel-control" href="#carousel-example-generic" data-slide="prev"&gt;
                  &lt;span class="glyphicon glyphicon-chevron-left"&gt;&lt;/span&gt;
              &lt;/a&gt;
              &lt;a class="right carousel-control" href="#carousel-example-generic" data-slide="next"&gt;
                  &lt;span class="glyphicon glyphicon-chevron-right"&gt;&lt;/span&gt;
              &lt;/a&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/BdBBD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BdBBD.png" alt="My Views folder"></a></p>