Debugging on a device emulator

by Bjørn Storkholm 19. December 2009 12:27

One thing I always hated about developing for mobile devices is waiting for deployment. Hit <F5> in Visual Studio... and wait for all the assemblies being copied to the device.
A workaround for this can be, to setup the device emulator’s storage card to point to the bin folder. Doing this you have instant access to the updated binaries, whenever you build. In the emulator click File -> Configure. In Shared Folder add the path to your target library.
Setup device emulator to point at storage card

With this, you can execute your program instantly upon a new build without waiting for deployment. But if you want to debug your code you can try to attach to process, and get an error saying Unable to attach to the process. Attach is not enabled for this process with this debug type.

 Error trying to attach to process

You’ll need to use Visual Studio’s remote tools Windows CE Remote Registry Editor to enable remote debugging. Add the following d-word to registry and set the value to 1:
HKLM -> Software -> Microsoft -> .NetCompactFramework -> Managed Debugger -> AttachEnabled

  Add AttachEnabled to registry
This enables debugging on the device, but be aware it slows down the device quite a bit, so it should only be done on development devices.
Doing it this way, you build and attach, no wait for deployment. It showed to be quite a time saver for me.

Note: In general it cannot be recommended to execute programs from the storage card, it can show to be quite unstable. But for debugging purposes it’s great.

LinQ and PocketOutlook

by Bjørn Storkholm 2. July 2009 13:22

I started writing a small application, which can handle objects in Pocket Outlook Object Model (POOM) items, aka Appointments, Contacts etc.

Writing a simple LinQ query to select my appointments, with a specific subject:

IEnumerable<Appointment> filteredAppointments = from appointment in appointments

                    where appointment.Subject == "Cornelius 2001"

                    select appointment;

 

 I was astonished to find, that this gives a compilation error, with a description saying “Could not find an implementation of the query pattern for source type”. Since I previously did a lot of work with POOM, I’m not that surprised with the fact, that there are always surprises.

Search Google for 5 minutes gave the solution. Explicitly specify the type of the object you want to select:

IEnumerable<Appointment> filteredAppointments = from Appointment appointment in appointments

                    where appointment.Subject == "Cornelius 2001"

                    select appointment;

Reinstalling windows mobile

by Bjørn Storkholm 9. May 2009 12:21

Since I got my first windows mobile device, I've been hating the license rules for the OS. Some years ago, I bought a danish QTek S200. Since I live in Denmark, it came with a danish OS.... I always hated danish operating systems.

I want to get the OS in english and install that (I'd even pay for it). Now that appeared to be a struggle. The danish OS had a higher version number than the english. The installer refused to do a "downgrade" to a lower version number. This appeared to me to be a way for HTC (QTEK), to prevent doing changes they wouldn't allow.

Those learnings is about 4 or 5 devices ago, and is still an issue to me. Whenever I get a new device, I prefer to buy a Danish one, since we have the special danish characters on the hardware keyboard (my current device is Touch Pro), but I don't want that crappy danish OS.

Beeing a little bit of a stubborn geek of nature, I needed to find out something about this. The keyword is Hard SPL. If you need to flash a device, with an OS that the vendor doesn't like, start googling for Hard SPL.

Powered by McDonalds

About Bjørn

Bjørn StorkholmBjørn Storkholm has been working in the IT industry since the mid 90es, with a primary focus on Microsoft technologies. Started developing on the dotNet platform in 2001, when it was in it's early beta stages.

About the blog

This is a place where I can discover my own findings, after they have slipped my memory. But maybe others can find some usefull stuff here as well.

The blog is powered by BlogEngine