title: Blazor rendering after computation or call
body: <p>making my first steps in Blazor!</p>
  <p>I have my page Test.razor with a simple grid:</p>
  <pre><code>&lt;table class=&quot;table&quot;&gt;
      &lt;thead&gt;
          &lt;tr&gt;Message&lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          @foreach (var exception in Exceptions)
          {
              &lt;tr&gt;exception.Message&lt;/tr&gt;
          }
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  <p>and my logic:</p>
  <p>public partial class Test</p>
  <pre><code>{
      public List&lt;TestEventModel&gt; Exceptions { get; set; }
  
  
      protected override async void OnInitialized()
      {
          var exceptionsResponse = (await http.GetAsync(&quot;TestController&quot;)).Content.ReadAsStringAsync();
          Exceptions = JsonConvert.DeserializeObject&lt;List&lt;TestEventModel&gt;&gt;(await exceptionsResponse);
  
      }
  }
  </code></pre>
  <p><strong>Problem</strong>: Unhandled exception rendering component: Object reference not set to an instance of an object.</p>
  <p>Exception occurring on the line :</p>
  <blockquote>
  <p>@foreach (var exception in Exceptions)</p>
  </blockquote>
  <p>But according to the lifecycle it should start rendering only after the execution of <strong>OnInitialized</strong>:</p>
  <p><a href="https://i.stack.imgur.com/P5Rwo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/P5Rwo.png" alt="enter image description here" /></a></p>
  <p>If indeed I initialize the list in a constructor for example, problem is not there, but of course the list will be empty and not showing the result of my http call.</p>