Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VS crash in CSharpSyntaxNode.ChildThatContainsPosition #502

Closed
amcasey opened this issue Feb 14, 2015 · 7 comments
Closed

VS crash in CSharpSyntaxNode.ChildThatContainsPosition #502

amcasey opened this issue Feb 14, 2015 · 7 comments

Comments

@amcasey
Copy link
Member

amcasey commented Feb 14, 2015

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()
@amcasey
Copy link
Member Author

amcasey commented Feb 14, 2015

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

@amcasey
Copy link
Member Author

amcasey commented Feb 14, 2015

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

@Pilchie
Copy link
Member

Pilchie commented Feb 18, 2015

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

@Pilchie Pilchie added this to the 1.0-rc2 milestone Feb 18, 2015
@amcasey
Copy link
Member Author

amcasey commented Feb 18, 2015

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

@Pilchie
Copy link
Member

Pilchie commented Feb 18, 2015

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

@amcasey
Copy link
Member Author

amcasey commented Feb 20, 2015

Happened again. I hit backspace and VS vanished.

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

@brettfo
Copy link
Member

brettfo commented Feb 20, 2015

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants