Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: Argument out of range exception: Length cannot be less than zero

  1. #11
    Join Date
    Oct 2007
    Location
    Southern California, US
    Posts
    769
    I'm just glad it was something simple like a URL change rather than something that affected the scraper.

  2. #12
    Join Date
    Nov 2006
    Location
    Pennsylvania, USA
    Posts
    809
    it was a fairly simple change, but it showed me that I need to put in better exception handling if things like this occur again...

    Plus, it brought to my attention a separate bug, which has been fixed

  3. #13
    Join Date
    Jun 2010
    Location
    South Africa
    Posts
    4

    Weather2 crashes

    I have a similar problem, I am using the latest version of Weather2, windows xp sp3. Location is Cape Town, no maps selected.
    log file extract is-
    2010-07-07 13:36:48.765 ERROR [6] FATAL UNHANDLED EXCEPTION:: System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
    Parameter name: length
    at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
    at weather2.CommonMethods.GetMonthDayFromDateTime(Dat eTime _date)
    at weather2.MapList.LoadMapDictionary()
    at weather2.MapList.LoadMaps(Boolean _downloadNewMaps)
    at weather2.AccuweatherXML.ParseDataAndDownloadMaps()
    at weather2.WeatherTask.ParseData()
    at weather2.WeatherTask.UpdateWeatherThread()
    at System.Threading.ThreadHelper.ThreadStart_Context( Object state)
    at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)
    at System.Threading.ThreadHelper.ThreadStart()
    Any suggestions

  4. #14
    Join Date
    Nov 2006
    Location
    Pennsylvania, USA
    Posts
    809
    Quote Originally Posted by Ericwm View Post
    I have a similar problem, I am using the latest version of Weather2, windows xp sp3. Location is Cape Town, no maps selected.
    log file extract is-
    2010-07-07 13:36:48.765 ERROR [6] FATAL UNHANDLED EXCEPTION:: System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
    Parameter name: length
    at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
    at weather2.CommonMethods.GetMonthDayFromDateTime(Dat eTime _date)
    at weather2.MapList.LoadMapDictionary()
    at weather2.MapList.LoadMaps(Boolean _downloadNewMaps)
    at weather2.AccuweatherXML.ParseDataAndDownloadMaps()
    at weather2.WeatherTask.ParseData()
    at weather2.WeatherTask.UpdateWeatherThread()
    at System.Threading.ThreadHelper.ThreadStart_Context( Object state)
    at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)
    at System.Threading.ThreadHelper.ThreadStart()
    Any suggestions
    I am guessing your regional settings has the year first? i.e. YYYY/MM/DD ?

    I have a fix for this, but I haven't made a release yet... As a current workaround, you could change your regional date settings in Windows to something else that doesn't start with a year.

  5. #15
    Join Date
    Jun 2010
    Location
    South Africa
    Posts
    4
    Thanks very much - I changed the short date format as you suggested and Weather2 is working fine.

  6. #16
    Join Date
    Nov 2006
    Location
    Pennsylvania, USA
    Posts
    809
    I uploaded a new version yesterday that fixes this problem (hopefully)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •