By default, support for attaching the debugger to a .NET Compact Framework application is disabled in NetCF v2. This is done to optimize the runtime performance of the application on the device. When attach to process support is enabled, the Just-In-Time compiler generates debuggable code. Debuggable code is larger (to accomodate breakpoints, some optimizations will be disabled) and as a consequence runs slower. Since all NetCF debugging is remote debugging, communications transports are also loaded, which increases the application's working set.
It is important to remember that attach to process support is a device global setting and that every application that runs on NetCF v2 will be run in attachable / debuggable mode. Because of this, I highly recommend enabling attach to process support only when you required and disabling it once you are finished debugging.
To ensure that the transports are properly installed on the device, I recommend deploying / debugging your application once using F5.
Enabling attach to process supportAttach to process support can be enabled (and disabled) using the Remote Registry Editor that is installed by Visual Studio 2005 Beta 2.
WARNING: Using Remote Registry Editor incorrectly can cause serious problems that may require you to hard reset your device. Microsoft cannot guarantee that problems resulting from the incorrect use of Remote Registry Editor can be solved. Use Remote Registry Editor at your own risk.
To disable attach to process support, follow the above steps and either delete the AttachEnabled value or set it to 0.
If you have Visual Studio 2005 Beta 2 installed, you can now start your applications without debugging support (ex: Ctrl+F5) and then attach to the process while it is running. I will discuss this more in future posts.
Take care,-- DK
Disclaimer(s):This posting is provided "AS IS" with no warranties, and confers no rights.Some of the information contained within this post may be in relation to beta software. Any and all details are subject to change.