Copied to clipboard

Flag this post as spam?

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


  • Mark V 20 posts 150 karma points
    Jan 08, 2020 @ 14:06
    Mark V
    0

    Miniprofiler crashing site: Index was outside the bounds of the array.

    A background task in Umbraco seems to have triggered Miniprofiler except instead it threw the following error causing the site to error:

    Umbraco.Core.Persistence.UmbracoDatabase - Exception.
    System.IndexOutOfRangeException: Index was outside the bounds of the array.
       at System.Collections.Generic.List`1.Add(T item)
       at StackExchange.Profiling.Timing.AddSqlTiming(SqlTiming sqlTiming) in c:\Code\github\SamSaffron\MiniProfiler\StackExchange.Profiling\Timing.cs:line 364
       at StackExchange.Profiling.MiniProfiler.AddSqlTiming(SqlTiming stats) in c:\Code\github\SamSaffron\MiniProfiler\StackExchange.Profiling\MiniProfiler.IDbProfiler.cs:line 101
       at StackExchange.Profiling.SqlTiming..ctor(IDbCommand command, ExecuteType type, MiniProfiler profiler) in c:\Code\github\SamSaffron\MiniProfiler\StackExchange.Profiling\SqlTiming.cs:line 72
       at StackExchange.Profiling.SqlProfiler.ExecuteStartImpl(IDbCommand command, ExecuteType type) in c:\Code\github\SamSaffron\MiniProfiler\StackExchange.Profiling\SqlProfiler.cs:line 53
       at StackExchange.Profiling.MiniProfiler.StackExchange.Profiling.Data.IDbProfiler.ExecuteStart(IDbCommand profiledDbCommand, ExecuteType executeType) in c:\Code\github\SamSaffron\MiniProfiler\StackExchange.Profiling\MiniProfiler.IDbProfiler.cs:line 117
       at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteDbDataReader(CommandBehavior behavior) in c:\Code\github\SamSaffron\MiniProfiler\StackExchange.Profiling\Data\ProfiledDbCommand.cs:line 239
       at Umbraco.Core.Persistence.PetaPocoCommandExtensions.<>c__DisplayClass5_0.<ExecuteReaderWithRetry>b__0()
       at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)
       at Umbraco.Core.Persistence.Database.<Query>d__74`1.MoveNext()
    

    I'm not sure what triggered it but it 'resolved' itself after it timed out. Debugging is turned off. Anyone know what's causing this?

    This is on Umbraco version 7.15.3

  • reekjohns 1 post 71 karma points
    Jul 29, 2020 @ 10:38
    reekjohns
    0

    This exception means that you're trying to access a collection item by index, using an invalid index. An index is invalid when it's lower than the collection's lower bound or greater than or equal to the number of elements it contains. Indexing an empty list will always throw an exception. Use a method like Add to append the item to the end of the list, or Insert to place the item in the middle of the list somewhere, etc. You cannot index into a list if that offset doesn't exist. IndexOutOfRangeException exception is thrown as a result of developer error. Instead of handling the exception, you should diagnose the cause of the error and correct your code.

  • Sébastien Lemieux 1 post 21 karma points
    May 25, 2021 @ 15:17
    Sébastien Lemieux
    0

    I know it's been over a year, but I am facing the same issue. Did you found what was causing the problem and how to fix it ?

  • Mark V 20 posts 150 karma points
    May 25, 2021 @ 15:44
    Mark V
    0

    We found out what was causing it but didn't find a real fix. We knew it was something to do with the examine indexes corrupting. It's a fairly large site and we've had issues with the indexes falling over in the past.

    I think the site rebuilt the indexes after detecting they were corrupt, and in the middle of the rebuilding it was also trying to access them which got the error I originally posted.

    The error never occurred again at least; so it seems it was a one off for us.

Please Sign in or register to post replies

Write your reply to:

Draft