Click here to Skip to main content
15,884,078 members
Articles / Programming Languages / Javascript

JScript Debugger– “Unable to attach the process. Another debugger might be attached to the process” – while application is running from Visual Studio. [ Solution ]

Rate me:
Please Sign up or sign in to vote.
5.00/5 (5 votes)
20 Jan 2012Ms-PL3 min read 60.5K   4   3
"Unable to attach the process. Another debugger might be attached to the process” – while application is running from Visual Studio. [Solution]

Internet Explorer Developer toolbar provides us a fantastic and easiest way to debug JavaScript with in browser. If the web site is hosted on IIS and you are trying to debug JavaScript using Internet Explorer Developer tool bar, it will work fine if you have the correct browser setting for debugging. If you are running your web application directly from Visual Studio, you might came across the problem of "Unable to attach to the process" while click on "Start debugging" button in Internet Explorer Developer toolbar. In this post, I am going to talk about the resolution of the same and will also talk about little bit behind the scene.

Problem

Internet Explorer Developer Toolbar – JS Debugger Error "Unable to attach the process. Another debugger might be attached to the process" .

Steps

  1. Run an ASP.NET application from Visual Studio.
  2. Once application launched, Press F12 in browser to launch Developer Toolbar.
  3. Move to "Script" Tab and Click on "Start Debugging". Put the necessary breakpoints on the script function as required before click.

image

On click of "Start Debugging", you will receive the below error message. which says, already another debugger attached and you cannot attach with current Internet Explorer Process for debugging.

image

Solution

Follow the below steps for resolve this issue.

  1. Go back to Visual Studio and Select "Detach All" from "Debug" menu.

    image

  2. Now click on "Start Debugging" from Internet Explorer Developer Toolbar. No error, and you can continue with debugging and other work.

Behind the Scene

Visual Studio automatically instantiates an Internet Explorer process to launch the web sites. You can check the process level using "Process Explorer".

image

Also, it attached the process "iexplore.exe" automatically during launch of site that helps us debug JavaScript from Visual Studio itself. You can check it from Solution explorer itself.

image

Which means, while your site is running in browser, "iexplore.exe" (Process for Internet Explorer) is already attached. One of the most simplest ways to check this out is, navigate to Debug > Windows> Processes. This will list out all attached processes within Visual Studio. For any typical ASP.NET web application which is running from Visual Studio will have two processes and iexplore is one of them.

image

That’s why when you are trying to attach the same process from Internet Explorer Developer toolbar, it is throwing an error "Unable to attach the process. Another debugger might be attached to the process" .

So now we know what was causing the issue and let’s have a look at what we did to resolve this.

As a resolution, we used "Detach All" from debug menu, which actually detached all the processes which are attached with Visual Studio except local ASP.NET Development server process (WebDev.WebServer40.EXE).

Note: "Detach All" will detach all the attached process apart from ASP.NET Development server. Because detaching the development server is nothing but stopping your application. If you want to stop, either stop debugging or "Terminate" the local development sever process.

"Detach All" will remove iexplore.exe from the list of attached process. So, you can go ahead and start the debugging in Internet Explorer Developer toolbar.

image

Detaching a Particular Process Instead of "Detach All"

If there are multiple processes attached and if you want to detach only "IE Process", you can simply do it from process attach window, by selecting "Detach Process" from the content menu of the "iexplore.exe". This will help you to retain other process in attached state.

image

To know more about Processes Window, check out this post:

Hope this helps!

Cheers!
Abhijit

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
Technical Lead
India India
.NET Consultant | Former Microsoft MVP - ASP.NET | CodeProject MVP, Mentor, Insiders| Technology Evangelist | Author | Speaker | Geek | Blogger | Husband

Blog : http://abhijitjana.net
Web Site : http://dailydotnettips.com
Twitter : @AbhijitJana
My Kinect Book : Kinect for Windows SDK Programming Guide

Comments and Discussions

 
QuestionIs there a way to change the settings so I don't have to do this every time? Pin
jsneeringer28-Dec-14 14:25
jsneeringer28-Dec-14 14:25 
GeneralMy vote of 5 Pin
Gaston Verelst28-Mar-14 2:35
Gaston Verelst28-Mar-14 2:35 
GeneralMy vote of 5 Pin
thatraja22-Jan-12 16:18
professionalthatraja22-Jan-12 16:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.