relativenumber icon indicating copy to clipboard operation
relativenumber copied to clipboard

ArgumentOutOfRangeException

Open giggio opened this issue 5 years ago • 1 comments

I just navigated from a services.AddDbContext to EntityFrameworkServiceCollectionExtensions.AddDbContext (pressed F12) and got an exception. VS 2019 showed me it could be an exception. I guess it comes from your extension, given the stack trace.

It called the methods RelativeNumber.RelativeNumber.OnCaretPositionChanged(Object sender, CaretPositionChangedEventArgs e) and then RelativeNumber.RelativeNumber.ApplyNumbers().

The stack trace was:

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at RelativeNumber.RelativeNumber.ApplyNumbers()
   at RelativeNumber.RelativeNumber.OnCaretPositionChanged(Object sender, CaretPositionChangedEventArgs e)
   at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.RaiseEvent[TArgs](Object sender, EventHandler`1 eventHandlers, TArgs args) 
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

giggio avatar May 14 '19 01:05 giggio

I have also seen this happen consistently when the file I am opening in Visual Studio has a file header at the top of the page (as provided by some other extension):

`#region FileHeader

// ChatMessages.cs // Created: 07/03/2018 10:13 AM // <copyright file=blah blah // Copyright (c) 2018. All rights reserved. // // Guy, That //

//

#endregion FileHeader `

dhartjes avatar Aug 07 '19 22:08 dhartjes