title: Visual Studio 2013 - Debugging MVC code with ViewBag properties deathly slow and unusable
body: <p>I'm trying out the latest Visual Studio, but debugging the most elementary MVC application with ViewBag dynamic variables gives me a lot of headache.</p>
  
  <p>I'm running Visual Studio 2013 under 32-bit Windows 8 operating system with clean install and every available update applied.</p>
  
  <p>I created new ASP.NET Web Application (.NET Framework 4.5 - New Solution) with folders and core references for MVC after which I added sample Home controller with some element code:</p>
  
  <pre><code>dynamic d1 = 1;
  dynamic d2 = 2;
  
  ViewData["Vd1"] = 1;
  ViewData["Vd2"] = 2;
  
  ViewBag.Vb1 = 1;
  ViewBag.Vb2 = 2;
  </code></pre>
  
  <p>Hitting breakpoint at the first line and stepping to the second until the ViewBag property worked fine (instantly) - then, in the Output window I got:</p>
  
  <blockquote>
    <p>A first chance exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in Microsoft.CSharp.dll</p>
  </blockquote>
  
  <p>...and stepping to the second line (ViewBag.Vb2...) took couple of seconds. I tested different dynamic variables to make sure the problems are with ViewBag properties.</p>
  
  <p><em><strong>What causes the exception and so slow debugging under IIS Express?</em></strong> Extensive use of ViewBag properties makes debugging a nightmare!</p>
  
  <p>Calling again the script under Debug don't cause the exceptions, and debug works fine because the Debugging Symbols are all loaded (guessing).</p>
  
  <p>I tried lots of different suggestions available at Stack Overflow and else over the net, but non of it works!</p>