This is a migrated thread and some comments may be shown as answers.

taskcanceledexception and webexception when showing images in radlistview

7 Answers 62 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Marc
Top achievements
Rank 1
Marc asked on 17 Aug 2017, 08:51 AM

When i try to show images in a radlistview, i get these exceptions.

No exceptions when using the xamarin listview, nor when commenting out the image from the template

 

xaml code : 

  <telerikDataControls:RadListView 
                                         IsLoadOnDemandEnabled="True"
                                         ItemsSource="{Binding Articles}"                                         
                                         LoadOnDemandMode="Automatic"  >
            <telerikDataControls:RadListView.LayoutDefinition>
                <telerikListView:ListViewGridLayout  ItemLength="100" VerticalItemSpacing="1" HorizontalItemSpacing="1" />
                </telerikDataControls:RadListView.LayoutDefinition>
                <telerikDataControls:RadListView.ItemTemplate>
                <DataTemplate>
                    <telerikListView:ListViewTemplateCell>
                        <telerikListView:ListViewTemplateCell.View>
                            <StackLayout >
                                <Image  Source="{Binding Image}"  />
                                <Label  Text="{Binding ArtNr}"/>
                            </StackLayout>
                        </telerikListView:ListViewTemplateCell.View>
                    </telerikListView:ListViewTemplateCell>
                </DataTemplate>
            </telerikDataControls:RadListView.ItemTemplate>
        </telerikDataControls:RadListView>

 

 

Viewmodel: 

 public class ArticleViewModel:BaseViewModel
    {
        public string ArtNr { get; set; }
        public ImageSource Image { get; set; }
        public ArticleViewModel(string artnr, string url)
        {
            this.ArtNr = artnr;
            Image = new UriImageSource
            {
                Uri = new Uri(url),
                CachingEnabled = false,
                CacheValidity = new TimeSpan(7, 0, 0, 0)

            };
        }
    }


    public class CatalogueViewModel : BaseViewModel
    {
        const int nrofitemstoload = 10;
        int loadTriggerCount;
        public ListViewLoadOnDemandCollection Articles { get; set; }

        public CatalogueViewModel() : base()
        {
            Articles = new ListViewLoadOnDemandCollection(loadondemand);

            var artvms = getarticles(loadTriggerCount * nrofitemstoload);
            foreach (var art in artvms)
            {
                Articles.Add(art);
            }

            Title = "Catalogus";
        }

        IEnumerable<ArticleViewModel> getarticles(int start)
        {
            var x = new List<ArticleViewModel>();
            for (int i = start; i < start + nrofitemstoload; i++)
            {
                x.Add(new ArticleViewModel($"article{start}_{i}", $"http://www.adsolut.be/images/website/logo.png?start={start}&stop{i}"));
            }
            return x;
        }

        IEnumerable<ArticleViewModel> loadondemand(CancellationToken token)
        {
            loadTriggerCount++;

            if (token.IsCancellationRequested)
                return new List<ArticleViewModel>();

            var articles = getarticles(loadTriggerCount * nrofitemstoload);

            return articles;
        }
    }

7 Answers, 1 is accepted

Sort by
0
Nikolay Demirev
Telerik team
answered on 21 Aug 2017, 08:18 AM
Hello Marc,

I have used your code to test the scenario, but it could not load any images and I can not make it throw any exception. Could you provide a sample project where the exception can be reproduced?

Regards,
Nikolay Demirev
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Marc
Top achievements
Rank 1
answered on 21 Aug 2017, 09:44 AM
https://drive.google.com/file/d/0B8FLKOCP3c5_RWxzWGtMUVNQeWM/view?usp=sharing
0
Nikolay Demirev
Telerik team
answered on 22 Aug 2017, 10:13 AM
Hello Marc,

I have tested your project and I have found an issue causing the images to disappear. I believe it is related to the same issue from this feedback item. You can follow it in order to receive updates on the progress on the matter.

Meanwhile, you could try using FFimageLoading as a workaround. It fixed the issues on my end.

I hope this helps.

Regards,
Nikolay Demirev
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Marc
Top achievements
Rank 1
answered on 22 Aug 2017, 11:25 AM

we are looking at the same project, right ? 

because i already tried that (and now Itried it again), and it makes no difference whatsoever....

the initial load (somewhat) works, but as soon as I scroll , it gets worse
can you confirm seeing taskcanceledexception and webexception ?

 

0
Nikolay Demirev
Telerik team
answered on 23 Aug 2017, 08:13 AM
Hello Marc,

I use the same project. There are no exceptions at all. Just if I use Image they disappear sometimes and the scrolling is really slow, because of the bug I have mentioned. With FFImageLoading it seems to work OK. I have tried scrolling and it works fine.

I am testing with VisualStudio for Mac Professional version 7.1 build 1297, with the latest update of the Xamarin.iOS 10.12.0.20 on iPhone 7 Simulator with iOS 10.3. Could you share your setup?

I can not think of any other difference because the project uses NuGet packages and the binaries can not be different.

Regards,
Nikolay Demirev
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Marc
Top achievements
Rank 1
answered on 23 Aug 2017, 09:32 AM

I tried running the solution from visual studio for mac, and it works??

 

I develop using

visual studio professional 2017  (15.3.2)

xamarin 4.6.0.229

xamarin.ios and xamarin.mac sdk 10.12.0.20 (same as on mac)

0
Nikolay Demirev
Telerik team
answered on 28 Aug 2017, 07:56 AM
Hello Marc,

I have tried to reproduce the issue on different machines with different configurations including one with the exact same versions of Visual Studio and Xamarin as yours and I was not able to reproduce the crash. The images are not rendered correctly, but the ListView scrolls without any exceptions.

If you can think of something that could help us reproduce the issue, please share it with us.

Regards,
Nikolay Demirev
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
ListView
Asked by
Marc
Top achievements
Rank 1
Answers by
Nikolay Demirev
Telerik team
Marc
Top achievements
Rank 1
Share this question
or