Over a million developers have joined DZone.

Unexpected Windows Phone Errors

DZone's Guide to

Unexpected Windows Phone Errors

If you've experienced issues in Windows Phone 8 where your active tile won't display, this tutorial may help solve that problem.

· Mobile Zone
Free Resource

Get gorgeous, multi-touch charts for your iOS application with just a few lines of code.

I've been updating an app that targets WP8.0.

In my free time, I've been looking through the dev center health reports to see if there are any exceptions occurring that I can do anything about.

It seems that I've not been defensive enough in my coding and previously didn't allow for things that should never happen from happening.

Yes, really.

Even if it's not displayed, an app should always have one tile, the "primary tile," that can be accessed in code so it can be updated.

Like this:

var primaryTile = ShellTile.ActiveTiles.First();

Except when it can't.

According to the stack traces, the above has failed.

The lesson? Always use `FirstOrDefault()` even when there should always be at least one and you want the first.

A page has a State dictionary that can be used for storing details while the app is deactivated/tombstoned.

You should always be able to access it and it should always exist:

protected override void OnNavigatedTo(NavigationEventArgs e)

    if (this.State.Count > 0) 

But then, apparently (according to the exception details) there may be an exception when accessing the `State` property.

For an app with over a million installs the number of times the above have happened is incredibly small, but may be worth noting if you want to be super robust in your code.

.Net developers: use Highcharts, the industry's leading interactive charting library, without writing a single line of JavaScript.

mobile ,windows phone ,c++

Published at DZone with permission of Matt Lacey, DZone MVB. See the original article here.

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 }}