Attached the debugger to a running .NET Compact Framework process
To attach the debugger to a running process on the device:
- On the Debug menu, click Attach to Process.
- In the Transport box, select Smart Device.
- To populate the Qualifier box, click Browse.
- In the Connect to Device dialog box, select the correct device type, and then click Connect.
- To populate the Attach to box, click Select.
- In the Available Processes box, select the process name, and then click Attach.
- You are now attached with the native debugger.
By default, devices, including emulators, do not allow the managed debugger to attach to processes that are already running. Attaching the managed debugger to an already running process is a situation that you typically encounter in device solutions that include both managed and native code.
To enable the managed debugger to attach to a running process:
- Open the Registry Editor for the target device, expand Windows Mobile 5.0 Pocket PC Emulator, and then create the following key:
- HKEY_LOCAL_MACHINESOFTWAREMicrosoft.NETCompactFrameworkManaged Debugger.
- Create a DWORD named AttachEnabled.
- Set the Name as AttachEnabled, and the Value as 1.
- You may need to restart Visual Studio, or at least close the running application on the device which you want to attach to.
Without this registry modification, there will be an error:
“Unable to attach to the process. Attach is not enabled for this process with this debug type.”
Reference: http://msdn.microsoft.com/en-us/library/ms228818.aspx