1

I have an ASP.NET MVC - Application which uses "IisExpress" when debugging. When I Debug (F5) the project, a new tab opens in browser.

When I now close any tab in that browser (not the one, that runs the website I try to debug), debugging ends immediately. I am using Chrome but I don't expect this to be browser-specific.

How can this be changed?

Update1: It may be worth mentioning that the Solution has multiple Startup-Projects, one of them a SharePoint Add-in

Update2: The following is been written to the output log when closing a tab and just before debugging stopps.:

The program '[4208] chrome.exe' has exited with code 0 (0x0).
The program '[15492] iisexpress.exe: Program Trace' has exited with code 0 (0x0).
The program '[10364] chrome.exe' has exited with code 259 (0x103).
The program '[12380] chrome.exe' has exited with code 259 (0x103).
The program '[10076] chrome.exe' has exited with code 259 (0x103).
The program '[8060] chrome.exe' has exited with code 259 (0x103).
The program '[8076] chrome.exe' has exited with code 259 (0x103).
The program '[7488] chrome.exe' has exited with code 259 (0x103).
The program '[7636] chrome.exe' has exited with code 259 (0x103).
The program '[12972] chrome.exe' has exited with code 259 (0x103).
The program '[15492] iisexpress.exe' has exited with code -1 (0xffffffff).
The program '[7384] chrome.exe' has exited with code 259 (0x103).
The program '[7468] chrome.exe' has exited with code 259 (0x103).
The program '[7476] chrome.exe' has exited with code 259 (0x103).
The program '[7884] chrome.exe' has exited with code 259 (0x103).
The program '[13360] chrome.exe' has exited with code 259 (0x103).
The program '[9768] chrome.exe' has exited with code 259 (0x103).
The program '[13804] chrome.exe' has exited with code 259 (0x103).
The program '[11008] chrome.exe' has exited with code 259 (0x103).
The program '[6920] chrome.exe' has exited with code 259 (0x103).
The program '[7364] chrome.exe' has exited with code 259 (0x103).
The program '[7372] chrome.exe' has exited with code 259 (0x103).
The program '[7392] chrome.exe' has exited with code 259 (0x103).
The program '[7400] chrome.exe' has exited with code 259 (0x103).
The program '[7420] chrome.exe' has exited with code 259 (0x103).
The program '[7936] chrome.exe' has exited with code 259 (0x103).
The program '[1900] chrome.exe' has exited with code 259 (0x103).
The program '[8496] chrome.exe' has exited with code 259 (0x103).
The program '[6288] chrome.exe' has exited with code 259 (0x103).
The program '[6616] chrome.exe' has exited with code 259 (0x103).

(But chrome is not really exited) but still running

When I start the project without debugging (Ctrl+F5), closing a tab does not seem to have an affect on IISExpress (the application continues)

Update3: Surprisingly this only happens when I close a tab that existed before I started debugging. Creating new tabs and closing those does not cause the debugger to stop.

wittich
  • 2,079
  • 2
  • 27
  • 50
Ole Albers
  • 8,715
  • 10
  • 73
  • 166
  • 1
    This does not look to be as the default behavior at all. At least I never had such an issue and never heard of it, so it seems something is doing this "feature" for you. – Ilya Chernomordik May 25 '16 at 12:17
  • My colleques have the same issue and we have no specific addins in VS – Ole Albers May 25 '16 at 12:19
  • Which Visual Studio version? – CodeCaster May 25 '16 at 12:26
  • @CodeCaster updated the tags – Ole Albers May 25 '16 at 12:28
  • [Exit code 259 (0x103) means the thread is still running](http://stackoverflow.com/questions/18887864/what-is-a-thread-exit-code). Besides that, as far as I remember, the Chrome process only runs very shortly as it passes the startup parameters (URL, ...) to the already running instance, which in turn opens a new tab. Maybe some Chrome update changed this, and Visual Studio still relies on the old behavior. – CodeCaster May 25 '16 at 12:31
  • Do you have Edit And Continue enabled on the project? In IIS Express, switch this *off* to have the app continue running when all "attached" browsers have disconnected. – freedomn-m Jun 09 '16 at 11:11

1 Answers1

1

This seems to be a default feature of IE, if all the tabs running the application is closed, the debugger is stopped. For an workaround, we did the following once:

  • Hosted the application in IIS, so the application is actually running whether we debug or not.
  • When the application is running, attach debugger to the IIS worker process(w3wp.exe).
  • This prevents the dependency on browser close, the debugger stays attached as long as the IIS worker process is running.

Hope it helps...

SamGhatak
  • 1,487
  • 1
  • 16
  • 27