This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 47701 - Label inside ViewCell from ListView will clear if updated after await Task.Delay(anyNumber)
Summary: Label inside ViewCell from ListView will clear if updated after await Task.De...
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms (show other bugs)
Version: 2.3.3
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-11-23 10:17 UTC by dpedrinha
Modified: 2017-07-10 07:55 UTC (History)
9 users (show)

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


Attachments
testcase project (1.42 MB, application/x-zip-compressed)
2016-11-23 10:23 UTC, dpedrinha
Details
repro project (303.23 KB, application/zip)
2016-12-13 18:42 UTC, Jimmy [MSFT]
Details

Description dpedrinha 2016-11-23 10:17:36 UTC
Let's say I want to create a clock.

If I update a regular Label after waiting for a second in an async function with Task.Delay(1000), it works.

But if I do it inside a custom ViewCell from a ListView, the Label will just clear, become blank.

Here's the part of the code where the problem happens:

while (!shouldStop)
            {
                label.Text = TimeSpan.FromTicks(DateTime.Now.Ticks).ToString(@"hh\:mm\:ss");
                await Task.Delay(1000);
            }

It updates the label the first time, then the label becomes blank.

I'm attaching a test project to see it in action. Just hit any Start Button.

BTW this code is working fine in iOS and wasn't tested in Android. This problem happens in UWP.
Comment 1 dpedrinha 2016-11-23 10:20:58 UTC
OK, I tried adding a testcase project, but the smallest file size I got was almost 20mb. And the limit is 8. And the project is a new project created just for this purpose.

Please guide me on how to do it.

Meanwhile, here's a link to it in my Dropbox: https://dl.dropboxusercontent.com/u/8897858/App2.zip
Comment 2 dpedrinha 2016-11-23 10:23:49 UTC
Created attachment 18610 [details]
testcase project

Ok, I managed to send a smaller file size, but without the packages. All I can say is that Forms was updated to the latest stable version today when I created this project.
Comment 3 dpedrinha 2016-11-24 17:27:15 UTC
I tried using Device.StartTimer and it doesn't work wither.
Comment 4 Jimmy [MSFT] 2016-12-13 18:42:54 UTC
Created attachment 18875 [details]
repro project

Attaching fixed repro project as the original was missing the .sln file
Comment 5 Jimmy [MSFT] 2016-12-13 18:43:44 UTC
I can confirm the issue on UWP with Forms 2.3.3
Comment 6 dpedrinha 2016-12-14 13:56:43 UTC
I tried using Device.BeginInvokeOnMainThread and it didn't work either. Same behavior.
Comment 7 Dennis Welu 2017-01-08 02:30:33 UTC
I've noticed a label going blank on me in the scenario described here too (XF 2.3.3/UWP/ListView/ViewCell). But I found this issue report while researching a similar problem...

I've found that while using an Entry view in the ViewCell that if you click into the Entry text (populated via code behind) the caret does not show. A window resize fixes the problem.

By comparison as a test, if I use an EntryCell it works fine.
Comment 8 Dennis Welu 2017-01-08 19:46:42 UTC
And just to add to the pattern, using a DatePicker in the ViewCell, after picking a date from the picker, the date display goes blank until a resize of the window...
Comment 10 Samantha Houts 2017-02-13 19:05:47 UTC
Should be fixed in 2.3.5-pre1. Thank you!
Comment 11 dpedrinha 2017-02-13 19:12:09 UTC
Thank you!
Comment 12 Saurabh Paunikar 2017-07-10 07:55:32 UTC
Verified on xamarin.form version 2.3.5.256-pre6.
ScreenCast link: https://www.screencast.com/t/m17rNOiU

Note You need to log in before you can comment on or make changes to this bug.