I have a VS2010 running on a WTS machine (Windows2008).
I'm trying to attach the debugger into a process. The process is running a WPF client.
The process is presented in the attach to process dialog, but grayed out and the attach button is disabled.
I read through the discussions, and confirmed managed code is enabled for debugger, with no luck. Here are two screenshots representing the current situation (in the first image, the process I'm trying to debug is marked in blue - please note I'm running as admin):
snapshot goes here - but was removed by stack overflow...
After trying the automatic code type selection, I tried the manual way, with no luck. Here is the screenshot:
snapshot goes here - but was removed by stack overflow...
Any help would be appreciated.
Thanks,
Busi
Perhaps you are already attached to the process? Did start debugging before attaching to the process?
Found another cause/solution to this problem, select the 'Show processes from all users' and 'Show processes in all sessions' check boxes and I got two instances of my service, one greyed out (which was always visible) and another I could attach to. hth :).
I ran into the same issue with my windows service.
I could not attach to a running windows service that I built.
My solution has multiple projects with the windows service as the startup project.
I found out that my problem is caused by having the startup project is the same as the windows service.
To solve my problem, I just set a different project as the StartUp Project.
I'm not certain, but there may be a debugger already attached to the process, and that's why Visual Studio won't let you attach it. Are you certain that you're not running the application already in debug mode or do you have another VS instance running?
If you are trying to attach a web service or web app (w3wp.exe) then, try resetting the iis (iisreset). It worked for me.
Related
I'd like to use Ollydbg2 to debug FLTLDR.EXE, which is spawned when my document is opened in Microsoft Word. I can't run FLTLDR.EXE manually I don't think, it seems to need to be run or hosted by Word.
I have ticked the "Debug child processes" in Olly and tried to debug Word, but an exception is raised before I can even open the document.
Any ideas?
Many thanks
For this you have to create a registry key to tell the OS that you want your app, FLTLDR.EXE, to be started with a debugger attached to it.
Follow the steps in the link:
https://msdn.microsoft.com/en-us/library/a329t4ed(v=vs.100).aspx
After setting the registry key just launch Word application. The execution of FLTLDR.EXE causes the ollydbg to start automatically. From this point you can continue debugging.
side note: receiving exceptions while attaching to some application with the debugger is normal. Most of the time Shift+F9 solves the problem and you can continue but if it's happening several times on a same address you can save the exception address and then Shift+F9...
I have two console application projects in a single solution and they are both configured to build to a common directory. The first app calls the second app via
Process proc = new Process();
proc.StartInfo.FileName = "myprocess.exe";
I can change my startup project and debug either one of them individually just fine, but I'm unable to step into the second project from the first project. When I look in build\debug I see the .pdb files for both apps and I know the second app is running completely through its routines. I just can't step into it. I've looked at Attach to Process and Debug:Location but haven't been able to find a solution yet. I've even tried putting them in different VS solutions, but to no avail.
So I need a way to step from the first project into the second project while debugging. Any suggestions would be appreciated.
Thank you.
You can use
Debugger.Launch();
which will bring up the dialog asking if you want to attach a debugger. You won't be able to 'step in' from the existing debugging session since it's attached to a different process.
I've been following this guide to debug a Windows Service application.
Basically, I need to attach the Visual Studio debugger to the process started after installing the Windows Service that has been developed. However, VS doesn't allow me attach the debugger to this process as shown in the following picture:
How can I attach the debugger to this process? If I clicked on any of the other processes the Attach button becomes enabled.
Any help would be greatly appreciated
check the checkbox Show processes from all users, then you will see AutomatedReports.exe. Attach that (not AutomatedReports.vshost.exe)
vshost is a host process to help with the debugging. More info on this MSDN Link
Also you need to place the following line in your service code where you want to hit the break point.
System.Diagnostics.Debugger.Break();
The service is probably running on a separate user account. Check the "Show processes from all users" checkbox and attach the debugger to AutomatedReports.exe process.
Also make sure that you are running a Debug build of the service, otherwise, you won't be able to debug a lot.
Have you tried to change the type of the code you are debugging?
Click on "Select ..."
Select "Debug these code types"
You can then select Types like: “Managed (v4.0…)"
Recently I tried to install a webpart through wspbuilder utility to the Sharepoint Site. I have created, built and deployed a project to the 12 hive. After that installed the solution through Cental Administration Site and activated in the site collection.
I just wonder how can I debug the complex feature/solution ? Because both processes (build-deploy and activate) totally independent, how can I attach a process with the worker process ?
In the WSPBuilder context menu there is an option "Attach to IIS worker process". As long as the app is loaded (generally means that you have accessed a page in the SharePoint site before trying to attach) and the code deployed in SharePoint is the same as the code you have in Visual Studio, you should be able to set breakpoints and step through the code.
First, you need to open up your browser and navigate to the SharePoint website in question. Then, In Visual Studio, go to Debug --> Attach to Process, and find the w3wp.exe process associated with the Sharepoint website that you want to debug. Click it (the process) and then click the Attach button. You should now be able to debug any activities associated with your SharePoint feature.
Sometimes it is a bit of a pain to figure out which w3wp process to attach to. Try adding the following to your code to break into the debugger:
System.Diagnostics.Debugger.Break();
System.Diagnostics.Debugger.Break()
Like Muhimbi suggested, this is actually very useful in certain cases. Say you want to debug custom code (e.g. feature_deactivating event) when it might be invoked with stsadm and not the browser. (for e.g. you will have to use stsadm for feature deactivation when feature is hidden in UI).When using stsadm you cannot attach to cmd.exe because that's a separate process. If you type the command and hit enter and then find its id of stsadm.exe process to attach to, its too late. In situations like these, the command above is the easist and best solution
I tried the steps as mentioned here
go to Debug --> Attach to Process, and find the w3wp.exe process associated with the Sharepoint website that you want to debug
But I get "Breakpoints will not be hit, no symbols have currently been loaded for this document". Should I have to register the custom deployed solution dll using GACUTIL ? Should I have to copy the PDB files at any particular location ?
What am I missing here ?
I'm using VS2010 Beta 2 and I turned on .NET Framework source stepping, so I had to disable 'Just My Code'. But now the w3wp.exe process doesn't show up in the list of processes I can attach to. I've got both show all processes boxes ticked. Is this a bug or am I missing something?
Make sure you have the Show processes in all sessions checkbox checked!
Ok, I found how to make it work, I rebuilt the whole solution and it started seeing the process again. This doesn't make a whole lot of sense to me, but oh well.
I fixed this by clicking Debug > Start Debugging, then once it starts up click Stop Debugging. Then I returned to the Attach to Process dialog and W3WP was in the list again.
Are you sure that the w3wp.exe process didn't die while debugging? Does it show up in Task Manager?
I couldn't find the process because the web page was still showing an error dialog and hadn't finished processing.
Make sure you have ended the previous debugging session (and run the web code to the end).
Closing Visual Studio did not help, the same goes for restarting IIS and rebuilding the solution.
As long as I was, some weird way, still attached to w3wp it did not show up in the attach list. Once I made sure the web page had finished and no dialogs of any kind was open, w3wp returned again.
You might need to be a member of the Administrators/Local Admins group for your machine.
Had this happen to me on one of our VMs today. Closing, re-opening VS2010 made no difference, rebuilding the website (!) made no difference.
But I logged out, logged in as administrator, added myself to the Administrators group, logged out, logged back in as myself, and once every application was loaded up -- I could get w3wp.exe appearing in the processes list for attaching.
In the absence of some other confirmation, it is possible that the act of logging out/logging-in again did the trick all by itself.
Try restarting Visual Studio. This worked for me.