
Enabling Attachment of the Managed 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.
Your first step is to set the device to allow for the managed debugger to attach to an already running process. You do this by setting a registry key on the device.
Note: |
|---|
Setting the key affects only attaching to already-running managed
processes. It does not affect starting a project by using Start with Debugging (F5). However, if you detach after Start with Debugging, you will need this process to reattach and start debugging again.
|
To enable the managed debugger to attach to a running process
On the Windows Start menu, point to All Programs, point to Microsoft Visual Studio 2008, point to Visual Studio Remote Tools, and then click Remote Registry Editor.
In the Select a Windows CE Device window, expand Windows Mobile 5.0 Pocket PC SDK, and then click Windows Mobile 5.0 Pocket PC Emulator. This is the target device for this walkthrough.
Click OK.
The Connecting to Device progress window opens, followed by the opening of the Device Emulator and the Windows CE Remote Registry Editor.
In the Registry Editor, expand Windows Mobile 5.0 Pocket PC Emulator, and then create the following key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsot\.NETCompactFramework\Managed Debugger.
Create the key by right-clicking .NETCompactFramework, pointing to New, and then clicking Key.
Note that there is a space between "Managed" and "Debugger".
Create a DWORD named AttachEnabled.
Create the DWORD by right-clicking Managed Debugger, pointing to New, and then clicking DWORD Value.
Set the Name as AttachEnabled, and the Value as 1.
Note: |
|---|
Setting this device debug key significantly reduces performance. When you are not debugging, disable this functionality by resetting the data value to 0.
|
Leave the Device Emulator open for the remaining steps to preserve the registry setting. You can close the Registry Editor.