Bug 53067 - iOS UITableViewCell images disappear after TestFlight update/overwrite from Xamarin Studio
Summary: iOS UITableViewCell images disappear after TestFlight update/overwrite from X...
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: master
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2017-03-06 07:10 UTC by chrisdavetv
Modified: 2017-04-10 23:04 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

iPhone usage screenshots (93.60 KB, application/zip)
2017-03-06 07:10 UTC, chrisdavetv

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description chrisdavetv 2017-03-06 07:10:01 UTC
Created attachment 20145 [details]
iPhone usage screenshots

I have a list of contacts displayed in a UITableViewController. Each contact is represented in a UITableViewCell. When the user runs the app for the first time, it generates a profile thumbnail with a random gradient color overlayed with the contact's initials. This is the normal expected behavior (see screenshot1.jpg). 

However, once the app is updated to a new version from TestFlight or updated straight from Xamarin Studio, the previously generated profile thumbnail is no longer displayed in the UIImage of any UITableViewCell (see screenshot2.jpg).

UITableViewSource.GetCell implementation:
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        var cell = tableView.DequeueReusableCell(CellIdentifier) as ContactsViewCell;
        if (cell == null)
            cell = (ContactsViewCell)ContactsViewCell.Nib.Instantiate(null, null)[0];

        ContactData item = indexedTableItems[keys[indexPath.Section]][indexPath.Row];

        return cell;

UITableViewCell.UpdateCell implementation:
    public void UpdateCell(ContactData contact) { 
        this.contact = contact; 

        var imageExists = UIImageUtil.ProfileImageExists(contact);
        if (imageExists)
            //ImageView = new UIImageView(ImageFrame);//this results in an image that doesn't disappear, but for some reason the programmatically generated image is not shown. Instead one of my bundle resource background images are shown (see screenshot3.jpg)

            ImageView.Image = UIImage.FromFile(contact.ProfilePic);//this shows the programmatically edited circular image i want, but it stops displaying after updating the app 

        TextLabel.Text = contact.Name;
        DetailTextLabel.Text = contact.Namelist;
        DetailTextLabel.TextColor = UIColor.LightGray;

First time posting a bug, so please let me know if you need anything else. 

Comment 1 chrisdavetv 2017-03-06 07:11:54 UTC
Some additional notes:

1. The programmatically generated images are created when the user opens the app for the first time. 

They are then stored using the ff code: System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), string.Format("{0}.png", contactname));

2. The generated image files still exist in the app's Documents folder after an over the air/direct Xamarin Studio update, but will no longer display in the UITableViewCell. Unless of course, the user deletes the app and makes a fresh install.

3. No images are being cached

4. No images are being downloaded

5. Scrolling the list causes no problems whatsoever

6. This has been happening on the stable Xamarin.iOS channel since mid last year when I started developing this app, but I can't find any similar issues in Xamarin Forums. I started looking into it when the behavior persisted into over the air TestFlight updates. Filing a bug in their bugzilla as well
Comment 2 Vincent Dondain [MSFT] 2017-03-07 00:56:28 UTC
Hi Chris,

Thanks for the bug, a couple comments and requests here.

First it's kinda hard to tell where the issue exactly comes from with the code you pasted (all looks good).

If I understand correctly, you're generating some images, save them in the iOS special folder, load them in your table view and whenever the app is updated / re-installed via XS the iOS special folder still has the generated images but those can no longer be accessed via code.

If I got the issue right I would say it does not really sound like a problem in the platform (Xamarin.iOS) but more like an iOS restriction or a local issue. Unless it did work with an old Xamarin.iOS (which doesn't seem to be the case based on comment #1 - 6.).

The best way to know that would be for us to get a proper test case (a simple project showing the issue or the original) so we can easily reproduce the issue (redeploying with XS) and then we'd investigate your code as well as potentially compare with a native solution.

Please provide us with a test case so we can move forward with this bug and feel free to post a question on Stack Overflow [0] or the Xamarin Forums [1]. Where you could get also get help from the broader developer community.

[0] http://stackoverflow.com/questions/tagged/xamarin
[1] https://forums.xamarin.com/

In case it might also be a helpful reference, you can find some general recommendations on the best places to ask various kinds of questions about Xamarin on:

Comment 3 Timothy Risi 2017-04-10 23:04:36 UTC
We have not received the requested information. If you are still experiencing this issue please provide all the requested information and re-open the bug report. Thanks!