Socket not working after WP7 tombstone resume

I’ve written an app that needs to connect to a WiFi router and broadcasts UDP packets. I was finding that after a tombstone and resume, the packets were no longer seen on the network using Wireshark. No errors were returned, the app was getting Success for the send and connect but it clearly wasn’t working.

It turns out that when the app resumed and the socket was reconnected, instead of defaulting to Wifi, it defaulted to MobileBroadbandGsm so it was sending the packets successfully but on the wrong network interface.

The solution turned out to be calling:


Thanks to Pat Long for his assistance.


Control your lights from Windows Phone 7 using LightwaveRF

Using a Nokia Lumia or one of the other windows phones you can now control your lights and other appliances (UK only I think).

The system is using LightwaveRF no PC required!

Step 1: Buy one of these LightwaveRF Wifi things and plug it into your Wifi router

LightwaveRF Wifi-link for Remote Iphone or Android Mobile Phone Lighting Control

Step 2: Swap your existing light switch for one of these (variety of colours available):

LightwaveRF Remote 1 Gang Dimmer 250w Black Chrome Light Switch

Step 3: Get the unofficial Home Remote RF app from the market place

1 of 5

I thought pairing the devices was pretty easy (much easier than X10 if you’ve used that and more reliable). LightwaveRF also has the advantage of remembering dim levels.

Read an in-depth review at:

Although the app featured in the review is for the official iPhone app not the unofficial WP7 one.

There was an error processing type ‘{0}’. Type member ‘{1}’ declared in ‘{2}’ is missing required ‘{3}’ property. If one class in the class hierarchy uses explicit sequencing feature ({3}), then its base class and all derived classes have to do the same.

This was due to having Order on some but not all DataMembers of the data contract (might have been more helpful if the error had actually contained values for the format parameters).

Useful frameworks and controls for WP7

Since I find myself using a common bag of goodies for WP7 development I thought I’d start listing them here.

Mvvm light*

NInject IoC

AgFX* (although using in conjunction with MVVM light you may find grating since concept of view model and model is a bit blurred although still blendable using the Sample Data approach).

Windows Phone Toolkit

Jump List Control

(although you should follow the suggestion in one of the follow up posts if you get an “unspecified error” because it doesn’t look as though Colin has updated the code).

* Also available on NuGET

Other stuff I want to look at but haven’t had a chance yet

WP7 Contrib – Caching, Messaging, Communciations, Services, Diagnostics and a bringing together of some good public WP7 controls.

AgFx–Looks Awesome!

WP7 framework for managing web-service calls including caching, queuing, priority, login handling, progress showing and blend-ability.

So I’ve joined the party of this framework late but it looks awesome. In my previous WP7 app I spent a lot of time creating queues of web requests, ensuring I could cancel pending requests if navigating away from pages but I didn’t have time to put the excellent features that AgFx appears to support.

The only issue I’ve got at the moment it doesn’t appear to pass back or accept the HTTP headers, just the response stream. Also you have to kind of forget MVVM light a bit since although there’s the separation of view and model, there isn’t much of a separation between viewmodel and model.

File or assembly name ‘System.Windows.debug.resources, Version=, Culture=en-US, PublicKeyToken=7cec85d7bea7798e’, or one of its dependencies, was not found.

This is apparently a known issue in WP7 Mango beta 2 & RC and can make debugging that bit more interesting.

One tip is to look at the Call Stack and ensure that “Show Parameter Values” is ticked (off by default):


Also see this post for some more discussion. It suggests this happens when you are checking for all thrown exceptions (Debug –> Exceptions…).