taskcanceledexception and webexception when showing images in radlistview

8 posts, 0 answers
  1. Marc
    Marc avatar
    7 posts
    Member since:
    Mar 2016

    Posted 17 Aug 2017 Link to this post

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

  2. Nikolay Demirev
    Admin
    Nikolay Demirev avatar
    179 posts

    Posted 21 Aug 2017 Link to this post

    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
  3. Marc
    Marc avatar
    7 posts
    Member since:
    Mar 2016

    Posted 21 Aug 2017 in reply to Nikolay Demirev Link to this post

    https://drive.google.com/file/d/0B8FLKOCP3c5_RWxzWGtMUVNQeWM/view?usp=sharing
  4. Nikolay Demirev
    Admin
    Nikolay Demirev avatar
    179 posts

    Posted 22 Aug 2017 Link to this post

    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
  5. Marc
    Marc avatar
    7 posts
    Member since:
    Mar 2016

    Posted 22 Aug 2017 in reply to Nikolay Demirev Link to this post

    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 ?

     

  6. Nikolay Demirev
    Admin
    Nikolay Demirev avatar
    179 posts

    Posted 23 Aug 2017 Link to this post

    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
  7. Marc
    Marc avatar
    7 posts
    Member since:
    Mar 2016

    Posted 23 Aug 2017 in reply to Nikolay Demirev Link to this post

    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)

  8. Nikolay Demirev
    Admin
    Nikolay Demirev avatar
    179 posts

    Posted 28 Aug 2017 Link to this post

    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
Back to Top