title: ASP.NET MVC3 Razor syntax help - I'm getting stuck in an infinite loop
body: <p>I'm trying to convert a small mvc2 application to the mvc3 razor syntax.  In my mvc2 application I'm using the aspx view engine with a master page.  Following the example from Steven Sanderson's Pro MVC2 book 2nd edition, in the masterpage I call a controller action that renders a partial view for each entity. This is working correctly.</p>
  
  <pre><code> &lt;div id="categories"&gt;
      &lt;% Html.RenderAction("Menu", "Nav"); %&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>using _layout.cshtml and razor I'm trying this.  Here is where my problem comes in.</p>
  
  <pre><code> &lt;div id="categories"&gt;
      @{ 
          Html.RenderAction("Menu", "Nav"); 
  
      }
  &lt;/div&gt;
  </code></pre>
  
  <p>This is causing an infinite loop now and I'm getting oddly enough a StackOverflowException.  Can anyone help me correct the problem?  Here is the controller method code.   </p>
  
  <pre><code>  public ViewResult Menu(string personId)
      {
          Func&lt;string, NavLink&gt; makeLink = pId =&gt; new NavLink
          {
              Text = pId ?? "Home"
              , RouteValues = new RouteValueDictionary(new { controller = "Person", action = "Person"})
  
          };
  
          List&lt;NavLink&gt; navLinks = new List&lt;NavLink&gt; {makeLink(null)};
  
  
          Func&lt;Person, NavLink&gt; makeLink2 = p =&gt; new NavLink
          {
              Text = p.Name ?? "Home"
              , RouteValues = new RouteValueDictionary(new { controller = "Person", action = "Person", personId = p.Id })
  
          };
  
          var people = usersRepository.People.OrderBy(x =&gt; x.Name);
          var peopleLinks = EnumerableHelpers.MakeLinks(people, makeLink2);
  
          navLinks.AddRange(peopleLinks);
  
          return View("_menu", navLinks);
      }
  </code></pre>
  
  <p>Any help or tips is most appreciated.  </p>
  
  <p>Thanks,<br>
  ~ck in San Diego</p>