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

SigHelp: ArgumentException: argumentCount < argumentIndex. 2 < 3 #72012

Closed
KirillOsenkov opened this issue Feb 8, 2024 · 3 comments · Fixed by #74510
Closed

SigHelp: ArgumentException: argumentCount < argumentIndex. 2 < 3 #72012

KirillOsenkov opened this issue Feb 8, 2024 · 3 comments · Fixed by #74510
Assignees
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead

Comments

@KirillOsenkov
Copy link
Member

  1. Paste this code
class C
{
    void Main()
    {
        M(0, d)
    }

    void M(int a, int b = 0, int c = 0, int d = 0) { }
}
  1. place the caret after d and before ) in the call to M
  2. Ctrl+Shift+Space to bring up sig help (IMPORTANT!)
  3. press :

Actual:

System.ArgumentException: argumentCount < argumentIndex. 2 < 3
Parameter name: argumentIndex
   at new Microsoft.CodeAnalysis.SignatureHelp.SignatureHelpItems(IList<SignatureHelpItem> items, TextSpan applicableSpan, int argumentIndex, int argumentCount, string argumentName, int? selectedItem) in C:/Roslyn/src/Features/Core/Portable/SignatureHelp/SignatureHelpItems.cs:line 76
   at SignatureHelpItems Microsoft.CodeAnalysis.SignatureHelp.AbstractSignatureHelpProvider.CreateSignatureHelpItems(IList<SignatureHelpItem> items, TextSpan applicableSpan, SignatureHelpState? state, int? selectedItemIndex, int parameterIndexOverride) in C:/Roslyn/src/Features/Core/Portable/SignatureHelp/AbstractSignatureHelpProvider.cs:line 68
   at async Task<SignatureHelpItems> Microsoft.CodeAnalysis.CSharp.SignatureHelp.InvocationExpressionSignatureHelpProviderBase.GetItemsWorkerAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, SignatureHelpOptions options, CancellationToken cancellationToken) in C:/Roslyn/src/Features/CSharp/Portable/SignatureHelp/InvocationExpressionSignatureHelpProvider.cs:line 126
   at void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<TResult>.Start<TStateMachine>(ref TStateMachine stateMachine)
   at Task<SignatureHelpItems> Microsoft.CodeAnalysis.CSharp.SignatureHelp.InvocationExpressionSignatureHelpProviderBase.GetItemsWorkerAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, SignatureHelpOptions options, CancellationToken cancellationToken)
   at async Task<SignatureHelpItems> Microsoft.CodeAnalysis.SignatureHelp.AbstractSignatureHelpProvider.GetItemsAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, SignatureHelpOptions options, CancellationToken cancellationToken) in C:/Roslyn/src/Features/Core/Portable/SignatureHelp/AbstractSignatureHelpProvider.cs:line 245
   at void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<TResult>.Start<TStateMachine>(ref TStateMachine stateMachine)
   at Task<SignatureHelpItems> Microsoft.CodeAnalysis.SignatureHelp.AbstractSignatureHelpProvider.GetItemsAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, SignatureHelpOptions options, CancellationToken cancellationToken)
   at async Task<(ISignatureHelpProvider provider, SignatureHelpItems items)> Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Controller+Session.ComputeItemsAsync(ImmutableArray<ISignatureHelpProvider> providers, SnapshotPoint caretPosition, SignatureHelpTriggerInfo triggerInfo, SignatureHelpOptions options, Document document, CancellationToken cancellationToken) in C:/Roslyn/src/EditorFeatures/Core.Wpf/SignatureHelp/Controller.Session_ComputeModel.cs:line 197

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Feb 8, 2024
@KirillOsenkov
Copy link
Member Author

P.S. You need to do this under debugger because there are no user-visible symptoms as far as I can see.

@CyrusNajmabadi CyrusNajmabadi removed their assignment Feb 8, 2024
@qgindi
Copy link

qgindi commented Jul 22, 2024

How VSCode responds to this exception: it does not show the parameter info UI.

How Visual Studio responds to this exception: the "Parameter info" feature stops working everywhere, until restarting. Tested with VS Community 2022 Preview Version 17.11.0 Preview 4.0.

@CyrusNajmabadi
Copy link
Member

Investigating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants