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

Assert fired at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode.ChildThatContainsPosition(int position) #723

Closed
mavasani opened this issue Feb 20, 2015 · 5 comments
Assignees
Labels
Area-Compilers Bug Language-C# Resolution-Duplicate The described behavior is tracked in another issue Verified
Milestone

Comments

@mavasani
Copy link
Member

Repro Steps:

  1. Open Roslyn.sln and open source file \Open\src\Compilers\Core\Portable\DiagnosticAnalyzer\AnalyzerDriver.cs
  2. Go to line 715, where this is an if statement with expression if (IsDiagnosticAnalyzerSuppressed(...)
  3. Double click on argument "addDiagnostic" to this invocation and hit "Delete" key

Got: Below assert, followed by VS crash (I can share a dump file if needed)

Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode.ChildThatContainsPosition(int position) Line 563 C#
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode.FindTokenInternal(int position) Line 629 C#
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode.FindToken(int position, bool findInsideTrivia) Line 725 C#
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.Blender.ExtendToAffectedRange(Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode oldTree, Microsoft.CodeAnalysis.Text.TextChangeRange changeRange) Line 132 C#
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.Blender.Blender(Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.Lexer lexer, Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode oldTree, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Text.TextChangeRange> changes) Line 60 C#
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.SyntaxParser.SyntaxParser(Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.Lexer lexer, Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LexerMode mode, Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode oldTree, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Text.TextChangeRange> changes, bool allowModeReset, bool preLexIfNotIncremental, System.Threading.CancellationToken cancellationToken) Line 54 C#
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.LanguageParser(Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.Lexer lexer, Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode oldTree, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Text.TextChangeRange> changes, Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LexerMode lexerMode, System.Threading.CancellationToken cancellationToken) Line 51 C#
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.CSharpSyntaxTree.WithChanges(Microsoft.CodeAnalysis.Text.SourceText newText, System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.Text.TextChangeRange> changes) Line 453 C#
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.CSharpSyntaxTree.WithChangedText(Microsoft.CodeAnalysis.Text.SourceText newText) Line 427 C#
Microsoft.CodeAnalysis.Workspaces.dll!Microsoft.CodeAnalysis.DocumentState.IncrementallyParseTreeAsync(Roslyn.Utilities.ValueSource<Microsoft.CodeAnalysis.TreeAndVersion> oldTreeSource, Roslyn.Utilities.ValueSource<Microsoft.CodeAnalysis.TextAndVersion> newTextSource, System.Threading.CancellationToken cancellationToken) Line 149 C#
Microsoft.CodeAnalysis.Workspaces.dll!Microsoft.CodeAnalysis.DocumentState.CreateLazyIncrementallyParsedTree.AnonymousMethod__0(System.Threading.CancellationToken c) Line 129 C#
Microsoft.CodeAnalysis.Workspaces.dll!Roslyn.Utilities.AsyncLazy<Microsoft.CodeAnalysis.TreeAndVersion>.StartAsynchronousComputation(Roslyn.Utilities.AsyncLazy<Microsoft.CodeAnalysis.TreeAndVersion>.AsynchronousComputationToStart computationToStart, Roslyn.Utilities.AsyncLazy<Microsoft.CodeAnalysis.TreeAndVersion>.Request requestToCompleteSynchronously) Line 380 C#
Microsoft.CodeAnalysis.Workspaces.dll!Roslyn.Utilities.AsyncLazy<Microsoft.CodeAnalysis.TreeAndVersion>.GetValueAsync(System.Threading.CancellationToken cancellationToken) Line 333 C#
Microsoft.CodeAnalysis.Workspaces.dll!Microsoft.CodeAnalysis.DocumentState.GetSyntaxTreeAsync(System.Threading.CancellationToken cancellationToken) Line 477 C#
Microsoft.CodeAnalysis.Workspaces.dll!Microsoft.CodeAnalysis.Document.GetSyntaxTreeAsync(System.Threading.CancellationToken cancellationToken) Line 198 C#
Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.RenameTracking.RenameTrackingTaggerProvider.TrackingSession.DetermineIfRenamableIdentifierAsync(Microsoft.VisualStudio.Text.SnapshotSpan snapshotSpan, bool initialCheck) Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<Microsoft.CodeAnalysis.Editor.Implementation.RenameTracking.RenameTrackingTaggerProvider.TriggerIdentifierKind>.Start<System.__Canon>(ref System.__Canon stateMachine) Unknown
Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.RenameTracking.RenameTrackingTaggerProvider.TrackingSession.DetermineIfRenamableIdentifierAsync(Microsoft.VisualStudio.Text.SnapshotSpan snapshotSpan, bool initialCheck) Unknown
Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.RenameTracking.RenameTrackingTaggerProvider.TrackingSession..ctor.AnonymousMethod__0() Unknown
mscorlib.dll!System.Threading.Tasks.Task<System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Editor.Implementation.RenameTracking.RenameTrackingTaggerProvider.TriggerIdentifierKind>>.InnerInvoke() Unknown
mscorlib.dll!System.Threading.Tasks.Task.Execute() Unknown
mscorlib.dll!System.Threading.Tasks.Task.ExecutionContextCallback(object obj) Unknown
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref System.Threading.Tasks.Task currentTaskSlot) Unknown
mscorlib.dll!System.Threading.Tasks.Task.ExecuteEntry(bool bPreventDoubleExecution) Unknown
mscorlib.dll!System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() Unknown
mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch() Unknown
mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback() Unknown
[Native to Managed Transition]
kernel32.dll!@BaseThreadInitThunk@12�() Unknown
ntdll.dll!__RtlUserThreadStart(long (void *) * StartAddress, void * Argument) Line 1029 C
ntdll.dll!_RtlUserThreadStart(long (void *) * StartAddress, void * Argument) Line 944 C

@srivatsn
Copy link
Contributor

@mattwar has been trying to find a repro for this

@mavasani
Copy link
Member Author

Actually I missed one step. Updated repro steps:

  1. Open Roslyn.sln and open source file \Open\src\Compilers\Core\Portable\DiagnosticAnalyzer\AnalyzerDriver.cs
  2. Go to the definition of IsDiagnosticAnalyzerSuppressed in the same file AnalyzerDriver.cs and delete line with parameter "addDiagnostic"
  3. Go to line 715, where this is an if statement with expression if (IsDiagnosticAnalyzerSuppressed(...)
  4. Double click on argument "addDiagnostic" to this invocation and hit "Delete" key

@Pilchie
Copy link
Member

Pilchie commented Feb 20, 2015

Note - I think that @brettfo also has a bug in SignatureHelp that ends up crashing in ChildThatContainsPosition. @pharring did you change the binary search that is used here recently?

@mattwar
Copy link
Contributor

mattwar commented Feb 20, 2015

This is the same issue as #605 that I have a pull request #736 that fixes.

@gafter gafter added the Resolution-Duplicate The described behavior is tracked in another issue label Feb 22, 2015
@gafter
Copy link
Member

gafter commented Feb 22, 2015

Closing as dup of #605.

@gafter gafter closed this as completed Feb 22, 2015
@gafter gafter added the Verified label Mar 9, 2015
@theoy theoy added the Bug label Mar 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Bug Language-C# Resolution-Duplicate The described behavior is tracked in another issue Verified
Projects
None yet
Development

No branches or pull requests

6 participants