Ever since I finished my MEDC 2006 presentation (APP326 - Essential Tips and Tricks for .NET Compact Framework Application Developers), I have been bothered by the fact that one of my demos did not work 100% as I had designed and practiced.  During the demo of debugging a P/Invoke call (based on this post),  I was unable to re-attach to the managed application.  This demo worked correctly at MEDC 2005, so why didn't it work this year?

After thinking about this for awhile, I realized that there was one major difference between 2005 and 2006...  This year, I decided to show setting the AttachEnabled registry key as part of the presentation.  Last year, I had pre-configured the device to support attach to process.  This is was the cause of my problem. 

While practicing my session, I had used the demo system (my laptop) to walk through each and every demo until I knew them backwards, forwards and inside-out.  I was very careful to always leave the device and emulator images in a known state (the beta of .NET Compact Framework v2 sp1 installed, the shared folder configured, etc) so that I would not run into any problems or deployment related delays.  My practices went flawlessly and the time came to do them "for real".

Those who attended the session may recall that there were actually two things that did not go smoothly for this particular demo.  First, while I was careful to leave the device and emulators in a known state, I forgot to make sure that I had reset the source code before starting the debugging demo and left the Debug.Assert statements that the demo required commented and, therefore, they did not execute.

The second (actually it was the first mistake that I made) was misspelling "AttachEnabled" when editing the device's registry.  Ryan Chapman later pointed out that he remembered seeing me type "AttachEnable" (missing the d).  After he mentioned that, all I could think was "oh no, how could I have made that mistake".  I will confirm this once I receive and watch the session recording, but I think Ryan is correct.  Fortunately, the slides have the correct registry data listed.

To make a long story short, when you watch the session recording, please be aware of this error and use the registry key (AttachEnabled) that is shown in my slides and here.  Sorry for the confusion that this may have caused at the show.

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.