title: MVC4 RenderAction causes stack overflow in _Layout.cshtml
body: <p>I want to implement a menu within my <code>_Layout.cshtml</code> view:</p>
  
  <pre><code>@Html.Partial("_LoginPartial")
  @{ Html.RenderAction("Index", "Home"); }
  
  @if (@ViewBag.Menus != null)
  {
      foreach (vw_UsuarioPerfilMenuFuncionalidade memo in @ViewBag.Menus)
      {
          if (memo.IdMenuLast == null)
          {
              &lt;li&gt;&lt;span&gt;@memo.NomeMenu&lt;/span&gt;&lt;/li&gt;
              foreach (vw_UsuarioPerfilMenuFuncionalidade memo2 in @ViewBag.Menus)
              {
                  if (memo.IdMenu == memo2.IdMenuLast)
                  {
                      &lt;li&gt;&lt;span&gt;@memo2.NomeMenu&lt;/span&gt;&lt;/li&gt;
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>When I load the page, a <code>System.StackOverflowException</code> is thrown:</p>
  
  <blockquote>
    <p>An unhandled exception of type 'System.StackOverflowException' occurred in System.Web.dll</p>
  </blockquote>
  
  <p>Why is that?</p>