Over a million developers have joined DZone.

Windows Phone Pitfall: Deployment.Current.Dispatcher

DZone's Guide to

Windows Phone Pitfall: Deployment.Current.Dispatcher

· Mobile Zone
Free Resource

Launching an app doesn’t need to be daunting. Whether you’re just getting started or need a refresher on mobile app testing best practices, this guide is your resource! Brought to you in partnership with Perfecto

You Windows Phone Developers will be interested to find out about a major pitfall (it might be considered a bug eventually) when you are building a component or application that needs to dispatch messages back to the UI thread.  Here were some of his potential solutions/workarounds to this side effect:

We don't have public access to information about the queued messages in the dispatcher, and of course there's also no way to manually manipulate them. So obviously there are two possible attempts: a) prevent posting to the UI thread once the application gets deactivated, or b) ignore undesired messages posted to the UI thread after activation. Both have a hacky smell to them, but the first one seems more promising. However, I've not yet thought about how this could be handled consistently or if it is possible at all; if I manage to come up with some clean solution, I will do a follow-up post about it.

You can get a full description of this potential pitfall and see example code by following the source link below:

Source: http://www.pitorque.de/MisterGoodcat/post/Windows-Phone-7-Pitfall-The-Dispatcher-and-Deactivation.aspx

Keep up with the latest DevTest Jargon with the latest Mobile DevTest Dictionary. Brought to you in partnership with Perfecto.


Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}