Attaching debugger to a running .Net CF process on smart device?
I've been testing the capabilities of the VS Beta 2 Debugger for device projects. Thus far I've been happy with the improvements.
However, I've been having a hard time in testing whether the debugger can now attach to running processes on devices -- I thought I heard this capability had been added, and I see some UI to support it.
Can someone let me know whether this should work in Beta 2, and if so, what I might be doing wrong? See below for my repro.
Thanks,
Andrew Brown
Asset Management International
Repro:
1. Start VS
2. "File | New | Project..."
3. Pick "Visual C# | Smart Device | Device Application", click OK
4. Build | Build Solution
5. Build | Deploy Solution
6. For Device, choose "Pocket PC 2003 SE Emulator", click Deploy
7. Go to the PPC2003 SE Emulator, start the app you just deployed
8. In VS, Debug | Attach to Process...
9. In attach dialog:
a. Pick "Smart Device" for Transport,
b. Browse to "Pocket PC 2003 SE Emulator" for Qualifier,
c. Set "Attach to" to "Automatic" or "Managed"
d. Pick the process you started on the emulator in step 7. above
e. Click Attach
Actual Result:
"Unable to attach to the process".
I'll try this tonight -- the necessary registry key setting was not set by me, and is almost definitely the missing piece.
Instead of the message box I got just saying "Unable to attach to the process", it would really be nice if you could point the user to a help topic such as this one. Consider this a suggestion for a future release :-)
Thanks,
Andrew Brown
Asset Management International
Hello Andrew. It sounds like from the repro steps you've given that you have not added the registry key required for Managed attach. If that is the case you will have to use the Remote Registry editor tool that is in your VS 2005 Program folder and add the following key:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETCompactFramework\Managed Debugger\]
"AttachEnabled"=dword:00000001
You must set this registry key before the process you wish to attach to has started. Any managed processes already running before you've set this key will need to be restarted for them to be attachable.
This key is only required for attaching to Managed processes. You can natively attach to any process without any special steps. V1 compiled applications running against the V1 framework will not be attachable at all since suport did not exist for Managed attach to process in the V1 time frame. V1 applications promoted to V2 will can be attached to with the Whidbey debugger without a recompilation.
Hope that gets you going.
Anthony Cangialosi
Visual Studio / SDET
Microsoft Corporation
The development environment is Windows XP /SP2, .net framework 1.1, Office XP Standard, and Visual Studio .net Enterprise. The application worked before but stopped in a sudden. There wasn't a change to the system during this time. When viewed from VS, the Excel process was attached. Click Detach then select Common Language Runtime and click Attach, the above error message popped up.
I searched all previous posts about this error and reinstalled .net framework 1.1, removed 2.0, reinstalled Office and Windows XP (repair) but none worked. There is a post on registry but it is about remote attach (my machine does not have that key and it worked before).
Appreciate any suggestion to the possible reason of the problem. Thank you.
Ming Zhao
mazhao@bigpond.net.au