Skip to content

VS crash in CSharpSyntaxNode.ChildThatContainsPosition #502

Description

@amcasey

I think I was bringing up sig help. VS just disappeared. I pulled this out of the event log:

Application: devenv.exe
Framework Version: v4.0.30319
Description: The application requested process termination through System.Environment.FailFast(string message).
Message: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: position
   at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode.ChildThatContainsPosition(Int32 position)
   at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode.FindTokenInternal(Int32 position)
   at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode.FindToken(Int32 position, Boolean findInsideTrivia)
   at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode.FindToken(Int32 position, Func`2 findInsideTrivia)
   at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode.FindToken(Int32 position, Boolean findInsideTrivia)
   at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode.FindTokenCore(Int32 position, Boolean findInsideTrivia)
   at Microsoft.CodeAnalysis.Shared.Utilities.FindTokenHelper.GetInitialToken[TRoot](SyntaxNode root, Int32 position, Boolean includeSkipped, Boolean includeDirectives, Boolean includeDocumentationComments)
   at Microsoft.CodeAnalysis.Shared.Utilities.FindTokenHelper.FindTokenOnLeftOfPosition[TRoot](SyntaxNode root, Int32 position, Func`3 skippedTokenFinder, Boolean includeSkipped, Boolean includeDirectives, Boolean includeDocumentationComments)
   at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxFactsService.FindTokenOnLeftOfPosition(SyntaxNode node, Int32 position, Boolean includeSkipped, Boolean includeDirectives, Boolean includeDocumentationComments)
   at Microsoft.CodeAnalysis.Editor.SignatureHelp.CommonSignatureHelpUtilities.TryGetSyntax[TSyntax](SyntaxNode root, Int32 position, ISyntaxFactsService syntaxFacts, SignatureHelpTriggerReason triggerReason, Func`2 isTriggerToken, Func`3 isArgumentListToken, CancellationToken cancellationToken, TSyntax& expression)
   at Microsoft.CodeAnalysis.Editor.CSharp.SignatureHelp.AttributeSignatureHelpProvider.TryGetAttributeExpression(SyntaxNode root, Int32 position, ISyntaxFactsService syntaxFacts, SignatureHelpTriggerReason triggerReason, CancellationToken cancellationToken, AttributeSyntax& attribute)
   at Microsoft.CodeAnalysis.Editor.CSharp.SignatureHelp.AttributeSignatureHelpProvider.<GetItemsWorkerAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.AbstractSignatureHelpProvider.<GetItemsAsync>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Controller.Session.<ComputeItemsAsync>d__10.MoveNext()
Stack:
   at System.Environment.FailFast(System.String, System.Exception)
   at Microsoft.CodeAnalysis.FailFast.OnFatalException(System.Exception)
   at Microsoft.CodeAnalysis.ErrorReporting.FatalError.Report(System.Exception, System.Action`1<System.Exception>)
   at Microsoft.CodeAnalysis.ErrorReporting.FatalError.ReportUnlessCanceled(System.Exception)
   at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Controller+Session+<ComputeItemsAsync>d__10.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
   at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Controller+Session+<ComputeItemsAsync>d__10.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Start[[Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Controller+Session+<ComputeItemsAsync>d__10, Microsoft.CodeAnalysis.EditorFeatures, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]](ComputeItemsAsync>d__10 ByRef)
   at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Controller+Session.ComputeItemsAsync(System.Collections.Generic.IList`1<Microsoft.CodeAnalysis.Editor.ISignatureHelpProvider>, Microsoft.VisualStudio.Text.SnapshotPoint, Microsoft.CodeAnalysis.Editor.SignatureHelpTriggerInfo, Microsoft.CodeAnalysis.Document, System.Threading.CancellationToken)
   at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Controller+Session+<ComputeModelInBackgroundAsync>d__5.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Start[[Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Controller+Session+<ComputeModelInBackgroundAsync>d__5, Microsoft.CodeAnalysis.EditorFeatures, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]](ComputeModelInBackgroundAsync>d__5 ByRef)
   at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Controller+Session.ComputeModelInBackgroundAsync(Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Model, System.Collections.Generic.IList`1<Microsoft.CodeAnalysis.Editor.ISignatureHelpProvider>, System.Collections.Generic.IList`1<Microsoft.CodeAnalysis.Editor.ISignatureHelpProvider>, Microsoft.VisualStudio.Text.SnapshotPoint, Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.DisconnectedBufferGraph, Microsoft.CodeAnalysis.Editor.SignatureHelpTriggerInfo, System.Threading.CancellationToken)
   at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Controller+Session+<>c__DisplayClass4_0.<ComputeModel>b__0(Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Model, System.Threading.CancellationToken)
   at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.ModelComputation`1+<>c__DisplayClass17_0[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].<ChainTaskAndNotifyControllerWhenFinished>b__0(System.Threading.Tasks.Task`1<System.__Canon>)
   at Roslyn.Utilities.TaskExtensions+<>c__DisplayClass14_0`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].<SafeContinueWithFromAsync>b__0(System.Threading.Tasks.Task)
   at System.Threading.Tasks.ContinuationResultTaskFromTask`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.Tasks.Task.ExecutionContextCallback(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean)
   at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

Activity

  1. amcasey commented on Feb 14, 2015

    @amcasey
    MemberAuthor

    Turns out I was actually completing the name of a local while typing into a call with named arguments at the beginning, but not at the end (e.g. F(x: x, y: y, z{completion here}, w);

    Dump is at %MyMachine%\dumps\ChildThatContainsPosition20150213.dmp

  2. amcasey commented on Feb 14, 2015

    @amcasey
    MemberAuthor

    There are no string literals or directives in the file, so I'm not sure why we're in ReferenceDirectiveCompletionProvider or IsEntirelyWithinStringLiteral.

  3. Pilchie commented on Feb 18, 2015

    @Pilchie
    Member

    @amcasey I don't see either of those methods on the stack you pasted? @brettfo, this looks like something you've investigated before.

  4. added this to the 1.0-rc2 milestone on Feb 18, 2015
  5. amcasey commented on Feb 18, 2015

    @amcasey
    MemberAuthor

    @Pilchie I was referring to thread 0x2BD8 in the dump I linked. I naively assumed that the stacks were related.

  6. Pilchie commented on Feb 18, 2015

    @Pilchie
    Member

    Ah, thanks - I didn't actually look at the dump :)

  7. amcasey commented on Feb 20, 2015

    @amcasey
    MemberAuthor

    Happened again. I hit backspace and VS vanished.

    Microsoft.CodeAnalysis.Editor.Implementation.RenameTracking.RenameTrackingTaggerProvider+TrackingSession+d__17.MoveNext()

  8. brettfo commented on Feb 20, 2015

    @brettfo
    Member

    Issue is being tracked and fixed as #605. Closing this in favor of the other one.

  9. added a commit that references this issue on Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions