All I've located the bug. I'll post the offending source code below, see if you can spot the error.
In version 1.8.0, in an effort to reduce the package size, I removed most of the PGI generated art and decided to have the app download the art from static.mwomercs.com instead. The theory was that if the package was smaller, I could upload it more frequently (the 36MB package took 16 min to upload). I was successful in reducing the package size to about 1.5 MB but there was a side effect that I hadn't anticipated (or experienced): static.mwomercs.com (the PGI image web server) would fail to deliver images to certain people.
I'm not certain what the logic is with regards to the server delivering no image or a corrupted image, but it does happen and seems to have to specific individuals repeatedly. So, while most users report no problem, some users report having nothing but problems.
The good news: I've "hardended" the app and it will no longer crash due to "bad" images from static.mwomercs.com
The bad news: I've not added any PGI art back to the package, so if PGI refuses to deliver art to you you're images will be blank.
internal static BitmapImage GetMechDoll(Chassis chassis)
{
BitmapImage bitmap = null;
string storagePath = String.Format("Art/Doll/{0}.png", chassis.Serial);
string networkUrl = chassis.DollUrl;
if (Constants.ForceLocalDollArt.Contains(chassis.Serial))
{
bitmap = new BitmapImage(new Uri("Art/Doll/" + chassis.Serial + ".png", UriKind.Relative));
}
else
{
lock (_wpfs)
{
if (_wpfs.FileExists(storagePath))
{
bitmap = new BitmapImage();
bitmap.SetSource(_wpfs.OpenFile(storagePath, FileMode.Open, FileAccess.Read, FileShare.Read));
}
else
{
WebClient webclient = new WebClient();
webclient.OpenReadCompleted += (object sender, OpenReadCompletedEventArgs e) =>
{
if (e.Cancelled || e.Result == null)
return;
try
{
lock (_wpfs)
{
if (!_wpfs.DirectoryExists("Art/Doll"))
{
_wpfs.CreateDirectory("Art/Doll");
}
using (System.IO.IsolatedStorage.IsolatedStorageFileStream stream = _wpfs.OpenFile(storagePath, FileMode.Create, FileAccess.Write, FileShare.Write))
{
byte[] buffer = new byte[1024];
int read = -1;
while ((read = e.Result.Read(buffer, 0, buffer.Length)) > 0)
{
stream.Write(buffer, 0, read);
}
stream.Flush();
}
}
}
catch { }
};
webclient.OpenReadAsync(new Uri(networkUrl, UriKind.Absolute));
bitmap = new BitmapImage(new Uri(networkUrl, UriKind.Absolute));
}
}
}
return bitmap;
}