Roslyn: AbstractSignatureHelpProvider crashes VS when listing overloads of generic methods

Created on 19 Nov 2018  路  13Comments  路  Source: dotnet/roslyn

When using Ctrl+Shift+Space within the argument list of a static generic method to list overloads, VS always crashes.

Repro steps:

git clone https://github.com/Microsoft/vs-streamjsonrpc.git
cd vs-streamjsonrpc
src\streamjsonrpc.sln

In VS, open the JsonRpcProxyGenerationTests.cs file.
On line 30:
this.clientRpc = JsonRpc.Attach<IServer>(this.clientStream);

Place your caret on at the start of clientStream and press Ctrl+Shift+Space to list overloads.

Crash.

Application: devenv.exe
Framework Version: v4.0.30319
Description: The application requested process termination through System.Environment.FailFast(string message).
Message: 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 Microsoft.CodeAnalysis.SignatureHelp.AbstractSignatureHelpProvider.Filter(IList`1 items, IEnumerable`1 parameterNames, Nullable`1 selectedItem)
   at Microsoft.CodeAnalysis.SignatureHelp.AbstractSignatureHelpProvider.CreateSignatureHelpItems(IList`1 items, TextSpan applicableSpan, SignatureHelpState state, Nullable`1 selectedItem)
   at Microsoft.CodeAnalysis.CSharp.SignatureHelp.InvocationExpressionSignatureHelpProvider.&lt;GetItemsWorkerAsync&gt;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 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.CodeAnalysis.SignatureHelp.AbstractSignatureHelpProvider.&lt;GetItemsAsync&gt;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.&lt;ComputeItemsAsync&gt;d__9.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&lt;System.Exception&gt;)
   at Microsoft.CodeAnalysis.ErrorReporting.FatalError.ReportUnlessCanceled(System.Exception)
   at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Controller+Session+&lt;ComputeItemsAsync&gt;d__9.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+&lt;ComputeItemsAsync&gt;d__9.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.ValueTuple`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]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Start[[Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Controller+Session+&lt;ComputeItemsAsync&gt;d__9, Microsoft.CodeAnalysis.EditorFeatures, Version=2.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]](&lt;ComputeItemsAsync&gt;d__9 ByRef)
   at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Controller+Session.ComputeItemsAsync(System.Collections.Immutable.ImmutableArray`1&lt;Microsoft.CodeAnalysis.SignatureHelp.ISignatureHelpProvider&gt;, Microsoft.VisualStudio.Text.SnapshotPoint, Microsoft.CodeAnalysis.SignatureHelp.SignatureHelpTriggerInfo, Microsoft.CodeAnalysis.Document, System.Threading.CancellationToken)
   at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Controller+Session+&lt;ComputeModelInBackgroundAsync&gt;d__4.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+&lt;ComputeModelInBackgroundAsync&gt;d__4, Microsoft.CodeAnalysis.EditorFeatures, Version=2.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]](&lt;ComputeModelInBackgroundAsync&gt;d__4 ByRef)
   at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Controller+Session.ComputeModelInBackgroundAsync(Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Model, System.Collections.Immutable.ImmutableArray`1&lt;Microsoft.CodeAnalysis.SignatureHelp.ISignatureHelpProvider&gt;, Microsoft.VisualStudio.Text.SnapshotPoint, Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.DisconnectedBufferGraph, Microsoft.CodeAnalysis.SignatureHelp.SignatureHelpTriggerInfo, System.Threading.CancellationToken)
   at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Controller+Session+&lt;&gt;c__DisplayClass3_0.&lt;ComputeModel&gt;b__0(Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Model, System.Threading.CancellationToken)
   at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.ModelComputation`1+&lt;&gt;c__DisplayClass17_0[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].&lt;ChainTaskAndNotifyControllerWhenFinished&gt;b__0(System.Threading.Tasks.Task`1&lt;System.__Canon&gt;)
   at Roslyn.Utilities.TaskExtensions+&lt;&gt;c__DisplayClass15_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]].&lt;SafeContinueWithFromAsync&gt;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()

_This issue has been moved from https://developercommunity.visualstudio.com/content/problem/385276/abstractsignaturehelpprovider-crashes-vs-when-list.html
VSTS ticketId: 731684_
_These are the original issue comments:_
(no comments)
_These are the original issue solutions:_
(no solutions)

Area-IDE Bug Developer Community Resolution-Duplicate Tenet-Reliability

All 13 comments

I'm hitting this today when typing a close parenthesis with the cursor on the end of the second line:

image

Let me know if an additional dump would be useful and I'll try to repro again.

@jnm2 Just hit this as well.

@mavasani can you take a look?

Also, this is a full VS crash, not a goldbar. Tagging @jinujoseph as well

I have a consistent repro on 16-p1.1 by typing RegexOptions.Multiline here:

using System.Text.RegularExpressions;

class C
{
    void M()
    {
        Regex.Split("", "", [||]);
    }
}

Sometimes it freezes when I type the final s of RegexOptions, sometimes when I type the final e of Multiline. Typing fast seems to help.
The entire UI freezes for ~10 seconds, then it crashes to the desktop. I have the same stack trace in Event Viewer.

I hit this multiple times a day. The workaround for me is to hit Ctrl+S a lot, and when typing a StringComparison I just hit Esc to close IntelliSense and type it in manually, like a cave man.

I just hit Esc to close IntelliSense and type it in manually

Ah, this is better than typing in a blank line to autocomplete and then cutting and pasting.

Investigating...

I believe this is fixed in preview2 https://github.com/dotnet/roslyn/pull/30997
cc @genlu for confirmation

From the stack trace it looks like the bug I fixed.

@davidwengier @jnm2 @CyrusNajmabadi Could you guys try deploying from master and see if the issue goes away?

Ah great. Thanks!

Was this page helpful?
0 / 5 - 0 ratings