1

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.

I'm running Visual Studio 2013 under 32-bit Windows 8 operating system with clean install and every available update applied.

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:

dynamic d1 = 1;
dynamic d2 = 2;

ViewData["Vd1"] = 1;
ViewData["Vd2"] = 2;

ViewBag.Vb1 = 1;
ViewBag.Vb2 = 2;

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:

A first chance exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in Microsoft.CSharp.dll

...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.

What causes the exception and so slow debugging under IIS Express? Extensive use of ViewBag properties makes debugging a nightmare!

Calling again the script under Debug don't cause the exceptions, and debug works fine because the Debugging Symbols are all loaded (guessing).

I tried lots of different suggestions available at Stack Overflow and else over the net, but non of it works!

Beaver
  • 257
  • 5
  • 12
  • The delay is more likely caused by that exception, and a few seconds (once) doesn't sound like a show stopper. – H H Oct 26 '13 at 22:02
  • Maybe it doesn't at the first sight, but if I have 10 dynamic ViewBag properties (for example) and for one (exception) I have to wait around 5 seconds - than that's 50 seconds total for only one controller and one action! If I terminate debug session, change some code and run it again, i will have to wait another 50 seconds to see the results... So, this is very significant issue, which I haven't seen on x64 Windows 8 under VS 2012. :| – Beaver Oct 27 '13 at 00:05
  • No, not 8.1 - regular Windows 8 Pro. – Beaver Oct 28 '13 at 21:45
  • I'm seeing exactly the same problem. MVC4/5, IIS Express, Windows 8.1 x64, Visual Studio 2013. I did not get this issue under Windows 7 x64 and Visual Studio 2012. Anyone any ideas? – Logic Labs Nov 28 '13 at 19:33
  • The answer is [in this question][1] [1]: http://stackoverflow.com/questions/2954531/lots-of-first-chance-microsoft-csharp-runtimebinderexceptions-thrown-when-dealin/6214985#6214985 – Dexion May 25 '15 at 10:44
  • The answer is [in this question][1]. [1]: http://stackoverflow.com/questions/2954531/lots-of-first-chance-microsoft-csharp-runtimebinderexceptions-thrown-when-dealin/6214985#6214985 – Dexion May 25 '15 at 10:46

2 Answers2

1

One of the overlooked and never reported issues on increasing debug speed for visual studio 2013 ASP .NET apps (MVC and webforms) is to disable browser link. This is a new feature in VS 2013 which causes a huge amount of overhead and causes pages to load extremely slowly (5-10 seconds in most of my cases). Disabling it brings it back to Visual Studio 2012 speeds.

See here for how to disable it:

http://blogs.msdn.com/b/webdev/archive/2013/06/28/browser-link-feature-in-visual-studio-preview-2013.aspx

Matt
  • 425
  • 3
  • 13
0

What worked for me was to choose another browser other than Internet Explorer. IF I used Chrome or Firefox, debugging is lightning fast. Turning off browser link did not help for Internet Explorer for me.

Here is a link on how to change to another browser when debugging.

http://www.asp.net/visual-studio/overview/2013/using-browser-link#browser-refresh

M Akin
  • 446
  • 6
  • 18