Beaver
Beaver

Reputation: 267

Visual Studio 2013 - Debugging MVC code with ViewBag properties deathly slow and unusable

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!

Upvotes: 1

Views: 4044

Answers (2)

M Akin
M Akin

Reputation: 507

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

Upvotes: 0

Matt
Matt

Reputation: 490

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

Upvotes: 1

Related Questions