1

As it was described in this question Is it possible to Edit and Continue in Visual Studio 2010 without pausing execution?, Edit and Continue can be used in combination with Break All to basically reload call on fly.

The problem is that when I invoke Break All in my ASP.NET MVC application, it'll show a "Code not running" tab. It'd be great if there was a way to either not show that tab, or to simply stay focused on the tab where I invoke Break All, so that I can immediately move on with my changes.

Most of the solutions I've found online suggest using Ctrl-, but that doesn't work on that tab. The only way I found is to use CtrlF4 to close it, but that doesn't feel right. Maybe this is caused by ASP.NET, or by Visual Studio 2013, but there doesn't seem to be a good way to do this now.

How are you guys reloading your code when working on ASP.NET MVC? Do you use Debug and Continue? And if so, is there a way to disable that annoying popup tab? Or should I just disable Edit and Continue altogether?

Community
  • 1
  • 1
Jakub Arnold
  • 85,596
  • 89
  • 230
  • 327

1 Answers1

1

ASP.NET MVC is different from traditional .exe during development, in that every web request is essentially a clean run through the stack. Therefore, you don't really have to have your app "running" in visual studio, unless you are actively trying to monitor the call stack on a particular function call.

In most situations, you are making changes and then testing those changes in a browser, through IIS Express. If you start your app using CTRL+F5, it spawns a process of IIS Express using your current .DLL in the bin/debug directory, but leaves visual studio in edit mode. If you make changes to your code and then compile using F6, the .DLL in the bin directory is updated, and the next browser request made to IIS express will use the new codebase. You can continually use F5 in the browser, observe the results, make changes, recompile, etc. without breaking your workflow.

It is only necessary to run Visual Studio in debug mode if you are actively trying to debug a method call and need to set breakpoints in the server code. Making changes to the razor views, adding new controllers/actions, etc. do not generally require you to debug. And in many cases, simply using console logging or other visual cues in your HTML / Razor can be used to trace variable states and further avoid the need to rely on server debugging.

ctrl + F5 is "start without debugging" by default, which will spawn a copy of IIS express in the system tray, and launch a browser. even if you close your browser window, the IIS express instance will still be running in the tray until you close visual studio. F6 is just to recompile the current code, and would only result in a quick "build successful" status message. While IIS Express is active in the system tray, multiple browser instances can all make requests to the port which is assigned to that server, without you needing to do anything else in Visual Studio. Recompiling the code doesn't affect the current status of any browser instances currently open, but immediately affects any future actions taken from any browser window.

Claies
  • 22,124
  • 4
  • 53
  • 77
  • If I first do CTRL+F5, and then try to do F6 nothing happens. Pressing CTRL+F5 again seems to restart the debugging and launch a new browser window though (feels kinda slower than building), but if I try to use CTRL+Shift+B it will ask me to stop the debugging. Am I doing something wrong? – Jakub Arnold Aug 27 '14 at 03:11
  • added a bit more context to my answer. Basically, don't start a debug session in visual studio at all unless you really need it. – Claies Aug 27 '14 at 03:19
  • @JakubArnold F6 might not be bound depending on your env settings, it is the shortcut to Build -> Build Solution – felickz Aug 27 '14 at 03:26