In this blog, I shall touch upon two important and cool features in VS 2005 device debugging.

Feature1: Attaching to NET CF V2 process

VS 2005 allows for attaching to a NET CF V2 process running on the device/emulator. This is disabled by default for performance reasons.To enable it one needs to set the value AttachEnabled to 1 at HKEY_LOCAL_MACHINE \SOFTWARE\Microsoft\.NETCompactFramework\Managed Debugger

 

Couple of notes:

-Any NET CF V2 process started after the above setting is attachable.

-Processes started before enabling are still not attachable.

-This is applicable only to V2 processes. This feature is not available for V1 processes.

-The feature can be disabled by setting the value AttachEnabled to 0.

 

https://blogs.msdn.com/davidklinems/archive/2005/05/24/421566.aspx talks in detail about this feature. So I would not want to duplicate the facts.

 

Feature2: Just In Time (JIT) debugging is an all powerful paradigm. Visual Studio 2005 provides infrastructure to do native JIT debugging on devices.

The way this is enabled is

- Go to <VS Install Directory>\SmartDevices\Debugger\target\wce400\cpu (for example, cpu is ARMV4i for Windows Mobile 5.0). 
- Copy eDbgJit.exe to the \windows folder on the device. 
- Start the executable file. This will enable the JIT debugging (if you are running on a device with a CE OS version < 5.0 you need to soft reset as well)

 

Assume now you have started a native application on the device and then it crashes for some reason. Then you would be prompted with a dialog whose contents should look like

An unhandled exception

was raised in "exe path +name"

(process id = xxxxxx)

To debug attach with

Visual Studio

To terminate, click OK.

 

Happy debugging !

 

Thanks

Srinivas N