dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
18.86k stars 4.01k forks source link

Exception triggering within Microsoft.CodeAnalysis.SignatureHelp when typing keyword argument #71846

Open pixlark opened 7 months ago

pixlark commented 7 months ago

As the title says, when I use keyword argument syntax while typing out a method call, an ArgumentException triggers inside Microsoft.CodeAnalysis.SignatureHelp.

To ensure that it is the C# extension at fault, I created a new VSCode profile with only the C# extension (and its dependencies) enabled, and the issue still happens. This is extremely irritating, because it causes an un-suppressable popup to flash on the screen, which I'm then forced to manually dismiss with my cursor.

Here is a demonstration of the bug occurring:

bugreport.webm

Here are the relevant C# logs:

``` Using dotnet configured on PATH Dotnet path: C:\Program Files\dotnet\dotnet.exe Activating C# standalone... waiting for named pipe information from server... [stdout] {"pipeName":"\\\\.\\pipe\\af1b019f"} received named pipe information from server attempting to connect client to server... client has connected to server [Info - 7:22:43 PM] [Program] Language server initialized [Info - 7:22:44 PM] [LanguageServerProjectSystem] Successfully completed load of d:\sympathetica\Sympathetica.Shared\Sympathetica.Shared.csproj [Info - 7:22:44 PM] [LanguageServerProjectSystem] Completed (re)load of all projects in 00:00:00.8972196 [Error - 7:23:16 PM] [LanguageServerHost] System.ArgumentException: argumentCount < argumentIndex. 2 < 4 (Parameter 'argumentIndex') at Microsoft.CodeAnalysis.SignatureHelp.SignatureHelpItems..ctor(IList`1 items, TextSpan applicableSpan, Int32 argumentIndex, Int32 argumentCount, String argumentName, Nullable`1 selectedItem) in /_/src/Features/Core/Portable/SignatureHelp/SignatureHelpItems.cs:line 76 at Microsoft.CodeAnalysis.SignatureHelp.AbstractSignatureHelpProvider.CreateSignatureHelpItems(IList`1 items, TextSpan applicableSpan, Nullable`1 state, Nullable`1 selectedItemIndex, Int32 parameterIndexOverride) in /_/src/Features/Core/Portable/SignatureHelp/AbstractSignatureHelpProvider.cs:line 68 at Microsoft.CodeAnalysis.CSharp.SignatureHelp.InvocationExpressionSignatureHelpProviderBase.GetItemsWorkerAsync(Document document, Int32 position, SignatureHelpTriggerInfo triggerInfo, SignatureHelpOptions options, CancellationToken cancellationToken) in /_/src/Features/CSharp/Portable/SignatureHelp/InvocationExpressionSignatureHelpProvider.cs:line 117 at Microsoft.CodeAnalysis.SignatureHelp.AbstractSignatureHelpProvider.GetItemsAsync(Document document, Int32 position, SignatureHelpTriggerInfo triggerInfo, SignatureHelpOptions options, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/SignatureHelp/AbstractSignatureHelpProvider.cs:line 302 at Microsoft.CodeAnalysis.LanguageServer.Handler.SignatureHelpHandler.HandleRequestAsync(TextDocumentPositionParams request, RequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/SignatureHelp/SignatureHelpHandler.cs:line 58 at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`3.StartRequestAsync(TRequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/QueueItem.cs:line 189 [Error - 7:23:16 PM] Request textDocument/signatureHelp failed. Message: argumentCount < argumentIndex. 2 < 4 (Parameter 'argumentIndex') Code: -32000 [object Object] Using dotnet configured on PATH ```

If more detail is needed, here is a full ZIP file of the extensions logs folder, with the log level set to "Trace":

output_logging_20240120T193416.zip

Finally, here is the environment information auto-generated by the bug report command:

Dotnet Information **VSCode version**: 1.85.1 **C# Extension**: 2.15.30 **Using OmniSharp**: false .NET SDK: Version: 8.0.101 Commit: 6eceda187b Workload version: 8.0.100-manifests.825c015e Runtime Environment: OS Name: Windows OS Version: 10.0.19045 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\8.0.101\ .NET workloads installed: Workload version: 8.0.100-manifests.825c015e There are no installed workloads to display. Host: Version: 8.0.1 Architecture: x64 Commit: bf5e279d92 .NET SDKs installed: 7.0.105 [C:\Program Files\dotnet\sdk] 8.0.101 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation] Environment variables: Not set global.json file: Not found Learn more: https://aka.ms/dotnet/info Download .NET: https://aka.ms/dotnet/download
Visual Studio Code Extensions |Extension|Author|Version|Folder Name| |---|---|---|---| |csharp|ms-dotnettools|2.15.30|ms-dotnettools.csharp-2.15.30-win32-x64| |vscode-dotnet-runtime|ms-dotnettools|2.0.0|ms-dotnettools.vscode-dotnet-runtime-2.0.0|;

Let me know if there's any other information needed.

jasonmalinowski commented 7 months ago

Also identified internally as AB#1733802 which is filed against @sharwell currently.

Pilchie commented 7 months ago

✅ Successfully linked to Azure Boards work item(s):