Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Barry Fogarty 493 posts 1129 karma points
    Sep 18, 2011 @ 15:37
    Barry Fogarty
    0

    Error loading IApplication: System.Reflection.TargetInvocationException

    Hi Darren, I have used your feed cache package on another project and it worked like a charm.  I set it up on my current project and all working fine with the default feeds.  When I connect it to a feed I need to cache:

    http://www.tescoplc.com/tertiary-content/press-release-search?rss=true&set=CR

    I get the following:

    Error loading IApplication: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: There is an error in XML document (6, 88). ---> System.Xml.XmlException: An error occurred while parsing EntityName. Line 6, position 88. at System.Xml.XmlTextReaderImpl.Throw(String res, String arg) at System.Xml.XmlTextReaderImpl.ParseEntityName() at System.Xml.XmlTextReaderImpl.ParseEntityReference() at System.Xml.XmlTextReaderImpl.Read() at System.Xml.XmlReader.ReadString() at System.Xml.XmlReader.ReadElementString() at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderConfiguration.Read2_Feed(Boolean isNullable, Boolean checkType) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderConfiguration.Read3_Configuration(Boolean isNullable, Boolean checkType) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderConfiguration.Read4_Configuration() --- End of inner exception stack trace --- at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) at FergusonMoriyama.Umbraco.FeedCache.Configuration.DeSerialiseFromDisk() at FergusonMoriyama.Umbraco.FeedCache.FeedCacheApplicationBase..ctor() --- End of inner exception stack trace --- at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at umbraco.BusinessLogic.Application.RegisterIApplications()

    Is this to do with the format of the feed itself?  THere are a couple of line breaks in there that seem wrong but otherwise there does not seem to be a problem with the format of the feed.

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Sep 19, 2011 @ 10:29
    Darren Ferguson
    0

    Hi Barry - What is at character 6  on line 88 of the feed - that is what the error is complaining about.

     

  • Lee Kelleher 3995 posts 15625 karma points MVP 12x admin c-trib
    Sep 19, 2011 @ 10:44
    Lee Kelleher
    0

    Hi Barry,

    As Darren says, the character at 6,88 is invalidating the XML.

    Character is question is the £ pound symbol. That needs to be converted to an HTML entity for it to work. Unless you've got any influence over the source of the RSS feed, there isn't much you can do about it.  (Well you could write a custom function to filter/replace the dodgy characters?)

    Cheers, Lee.

  • Barry Fogarty 493 posts 1129 karma points
    Sep 19, 2011 @ 12:51
    Barry Fogarty
    0

    Hi guys, thanks for your help with this.  Its a strange one - if I copy the whole feed XML and create a local file, it works fine.  But if I point it at the actual live feed, I get the error as described.  I can only think that it is to do with

    That said if you visit the feed in a browser it renders as an RSS feed fine.  I validated it on W3C and it points out it does not validate due to date format, duplicate GUIDs and line breaks in the link elements. However I have not changed any of these things in my local version and FeedCache works fine.

    I can request the feed format be changed to accomodate the system, but at the moment I cannot definitively say what it is that is causing it to break.

    @Lee - if I go to Line 6 col 88 in the raw feed, it is the letter 's' in the middle of a link.

  • Barry Fogarty 493 posts 1129 karma points
    Sep 21, 2011 @ 15:57
    Barry Fogarty
    0

    Just to follow up on this, I got the original developer to clean up the feed and deploy it, but the issue is persisting.  I have ensured I have updated the config and restarted IIS:

    http://tescoplc.webdev.merchant.co.uk/tertiary-content/press-release-search?rss=true&set=all

    I know it is not a general problem as I have many other feeds connected and it caches them perfectly.  The very strange thing is if I copy this file locally and save it as a flat XML, it is cached fine.  Which is annoying, as I cannot narrow down the cause of the problem.

    @Darren, would you mind terribly throwing your eye over it and perhaps even seeing if you are experiencing the same issue?  Just so I know its not my system.  I have traced all the way through the feed and gone to the character position supposedly causing the exception, but it is just a standard charatcer in the middle of a link.  The error I get is below.

    Error loading IApplication: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: There is an error in XML document (27, 97). ---> System.Xml.XmlException: An error occurred while parsing EntityName. Line 27, position 97. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.ParseEntityName() at System.Xml.XmlTextReaderImpl.ParseEntityReference() at System.Xml.XmlTextReaderImpl.Read() at System.Xml.XmlReader.ReadString() at System.Xml.XmlReader.ReadElementString() at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderConfiguration.Read2_Feed(Boolean isNullable, Boolean checkType) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderConfiguration.Read3_Configuration(Boolean isNullable, Boolean checkType) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderConfiguration.Read4_Configuration() --- End of inner exception stack trace --- at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle) at System.Xml.Serialization.XmlSerializer.Deserialize(TextReader textReader) at FergusonMoriyama.Umbraco.FeedCache.Configuration.DeSerialiseFromDisk() at FergusonMoriyama.Umbraco.FeedCache.FeedCacheApplicationBase..ctor() --- End of inner exception stack trace --- at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at umbraco.BusinessLogic.Application.RegisterIApplications()
  • Barry Fogarty 493 posts 1129 karma points
    Sep 21, 2011 @ 17:44
    Barry Fogarty
    0

    FYI The following much simpler feed throws the same error (on the same line number strangely!)

    http://www.tescoplc.com/tertiary-content/press-release-search?rss=true&set=International

    This one has no special chataers, it validates and I am out of ideas on why it would fail.  Would be great if someone can corroborate the behaviour I am experiencing. :-)

  • Lee Kelleher 3995 posts 15625 karma points MVP 12x admin c-trib
    Sep 21, 2011 @ 18:01
    Lee Kelleher
    0

    With all sincerity, I still believe that it's the £ pound character that is causing you grief. (Honestly not trying to steer you on a wild goose-chase)

    Only reason I can see the difference between testing this locally and remote is that the character encodings are different? Local is most likely encoding as UTF-8 (or een UTF-16?) and the remote server might be encoding in ISO-8859-1?  I dunno it's difficult to judge.

    As for the line numbers - I don't think they are literal line numbers, more that they are line numbers once the parser is trying to process the XML (juggled whitespace, etc).

    Cheers, Lee.

  • Barry Fogarty 493 posts 1129 karma points
    Sep 22, 2011 @ 13:34
    Barry Fogarty
    0

    Hi Lee.  Thanks for being patient here.  You must be right, otherwise it makes no sense.  I got all £'s stripped out but it is still an issue.  Would % case the same issue, you think?  Seems a bit daft that the tool cannot handle these.  THey are only in the content elements, not links.  Pity as I have a system that is supposed to pull and cache 20 - 30 feeds, I thought Feed Cache would be ideal.. but its not viable if it does not have some means of exception handling

    @Darren - any chance of the source?  I will try catch out the errors and just not include any offending rss items in the cached feed.   You can release as an update to the community if you like :-)

    Feed for your reference:
    http://tescoplc.webdev.merchant.co.uk/tertiary-content/press-release-search?rss=true&set=all

    Error is caused on line 28 col 98, but as you say Lee it ismpossible to tell where the tool sees lines and cols, looking at it through view source shows nothing suspicious anywhere near that position.

  • Lee Kelleher 3995 posts 15625 karma points MVP 12x admin c-trib
    Sep 22, 2011 @ 13:37
    Lee Kelleher
    0

    Hi Barry,

    The source is up on Darren's BitBucket account: https://bitbucket.org/darrenjferguson/open-source-umbraco-packages

    Curious to know what the problem is too now. Let us know if you figure it out. Good luck!

    Cheers, Lee.

  • Barry Fogarty 493 posts 1129 karma points
    Sep 22, 2011 @ 17:19
    Barry Fogarty
    0

    SOLVED!   After debugging Darren's source I realised it was the Deserialize method throwing the error - i.e. my local FeedCache.config file!  Hadn't even crossed my mind..  Once I made that leap the error was obvious (if not a little embarrasing):

    Replace the &'s in your feed URLs with &

     

    :-S

    Thanks for your persistence Lee... prob would have saved hours of messing arround if my posted feed URLs were not shortened in my posts.  Ah well hopefully I will save someone else that by posting here.  Now I've got to tell the guy I've had tweaking the live feeds for me all day...

     

  • Chris Knowles 141 posts 222 karma points
    Oct 10, 2011 @ 12:42
    Chris Knowles
    0

    Barry,

    When you say replace the &'s with & do you mean to retype them or use the & amp ; ?

    I am having exactly this problem with a twitter feed.

    Thanks

    Chris

  • Barry Fogarty 493 posts 1129 karma points
    Oct 10, 2011 @ 12:53
    Barry Fogarty
    0

    Hi Chrise, you are correct, it stripped my code from my last message.  Replace your ampersands with & amp ;

    (without spaces)

    Failing that you can try the HTML encoding notation (% 7E  or something) .. But the above worked for me.

  • Chris Knowles 141 posts 222 karma points
    Oct 10, 2011 @ 13:00
    Chris Knowles
    0

    Thanks Barry,

    I'm getting a different error message now, object reference not set to instance of an object, but thanks for your help.

    Chris

Please Sign in or register to post replies

Write your reply to:

Draft