תשובה Syndication feed dropping without explination

  • יום רביעי 08 אוגוסט 2012 02:34
     
      קוד כלול

    I'm working on a Windows 8 app in C#.  I'm pulling a RSS+XML feed that, based on results in Fiddler, are well formed.  Some times the code builds 30 data objects but most of the time it drops out at the "currentFeed = await client.RetrieveFeedAsync(uri);" without generating an error.  Any assistance is greatly appreciated.

            async void GetFeed()
            {
                try
                {
                    SyndicationFeed currentFeed = null;
                    Uri uri = new Uri("http://ivy.nowsprouting.com/lifebridgechristianchurch/podcast.php?pageID=39");
                    SyndicationClient client = new SyndicationClient();
                    client.BypassCacheOnRetrieve = true;
                    currentFeed = await client.RetrieveFeedAsync(uri);
                    var reader = currentFeed.GetXmlDocument(SyndicationFormat.Rss20);
    
                    foreach (var content in currentFeed.Items)
                    {
                        foreach (var link in content.Links)
                        {
                            AllItems.Add(new MessageDataItem(content.Id.ToString(), content.Authors.ToString(), content.Title.Text,currentFeed.Subtitle.Text, link.Uri.ToString(), content.NodeValue.ToUpperInvariant()));
                        }
                    }
                }
                catch (Exception ex)
                {
                    SyndicationErrorStatus status = SyndicationError.GetStatus(ex.HResult);
                }
            }

כל התגובות

  • יום רביעי 08 אוגוסט 2012 19:49
    מנחה דיון
     
     
    When you say it drops out, what does that mean?  Try removing that try/catch and see what happens.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

  • יום רביעי 08 אוגוסט 2012 20:25
     
     
    Thanks Matt.  I have run it with and without the try catch.  Initially my screen came back empty so I started walking the code in debug and when I first boot up it will build 30 records any iterations after that the code hits the "currentFeed = await client.RetrieveFeedAsync(uri);" line and returns to the calling method without executing the lines below it.
  • יום שישי 10 אוגוסט 2012 20:03
    מנחה דיון
     
     הצעה לתשובה
    I'm running RTM bits and I have not been able to reproduce this problem.  I've tried over 20 times.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

  • שבת 11 אוגוסט 2012 00:43
     
     

    Forgive me Matt. I had no idea that Microsoft personnel answered these questions.  It was not my intention to waste anyone's time. I'm attaching the complete code.

    http://sdrv.ms/OYG7ET

  • יום שני 13 אוגוסט 2012 20:15
    מנחה דיון
     
     הצעה לתשובה
    You didn't waste my time - part of my signature is the code thing because I often get very incomplete snippets of code that I can't figure out. 

    I already tested your code as you wrote it above, and I couldn't reproduce any problem on RTM bits.  Your code doesn't seem to have any problems, I think that there's either a bug in RP that's been fixed in RTM (which I am using), or you are experiencing environmental issues. 

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

  • יום שני 13 אוגוסט 2012 23:50
     
     תשובה קוד כלול

    Matt,

              Thank you so much for you time and efforts.  I figured out my problem and you were correct in that the syndication feed was building correctly.  I was not accounting for the data being cached so when I ran multiple iterations it didn't build records because they were already there. However, unlimitedly,  my problem was that I was missing the all important:

    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"

     and the tiles were not being rendered.  I assumed that with a collection count of zero and no tiles that the syndication feed was the problem. I'm new to C# and have only studied the text of MVVM which I see has some presence in the "Windows 8" style interface.

    Thanks again.

    • סומן כתשובה על-ידי jbrown9100 יום שני 13 אוגוסט 2012 23:50
    •