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

Index was outside the bounds of the array. in SignatureHelp.getSignatureHelpFor #950

Closed
kojo12228 opened this issue Jun 4, 2022 · 4 comments

Comments

@kojo12228
Copy link
Contributor

In PmaBolero, I was seeing VSCode crash after about 10-30 minutes of coding 5 or 6 times yesterday. Taking a look at the logs, I was seeing a lot of:

[18:31:13.402 ERR] [LSP] PositionHandler - Failed during child operation on file <path_omitted>\PmaBolero\src\PmaBolero.Client\Pages\Main.fs
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at <StartupCode$FsAutoComplete-Core>.$FileSystem.TryGetPrevChar@213.Invoke(Position np) in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete.Core/FileSystem.fs:line 213
   at Microsoft.FSharp.Core.OptionModule.Map[T,TResult](FSharpFunc`2 mapping, FSharpOption`1 option) in D:\a\_work\1\s\src\fsharp\FSharp.Core\option.fs:line 53
   at FsAutoComplete.SignatureHelp.loop@231-22(NamedText lines, Char ch, Position pos) in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete.Core/SignatureHelp.fs:line 232
   at FsAutoComplete.SignatureHelp.getSignatureHelpFor@230.Invoke(Unit unitVar) in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete.Core/SignatureHelp.fs:line 240
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2) in D:\a\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 447
   at <StartupCode$FsAutoComplete-Core>.$CompilerServiceInterface.ParseAndCheckFileInProject@340-11.Invoke(AsyncActivation`1 ctxt) in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete.Core/CompilerServiceInterface.fs:line 340
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in D:\a\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 104
[Error - 18:31:33] Request textDocument/documentHighlight failed.
  Message: No symbol information found
  Code: -32603 
[Error - 18:31:35] Request textDocument/documentHighlight failed.
  Message: No symbol information found
  Code: -32603 
[18:32:21.624 ERR] [LSP] PositionHandler - Failed during child operation on file <path_omitted>\PmaBolero\src\PmaBolero.Client\Pages\Main.fs
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at <StartupCode$FsAutoComplete-Core>.$FileSystem.TryGetPrevChar@213.Invoke(Position np) in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete.Core/FileSystem.fs:line 213
   at Microsoft.FSharp.Core.OptionModule.Map[T,TResult](FSharpFunc`2 mapping, FSharpOption`1 option) in D:\a\_work\1\s\src\fsharp\FSharp.Core\option.fs:line 53
   at FsAutoComplete.SignatureHelp.loop@231-22(NamedText lines, Char ch, Position pos) in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete.Core/SignatureHelp.fs:line 232
   at FsAutoComplete.SignatureHelp.getSignatureHelpFor@230.Invoke(Unit unitVar) in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete.Core/SignatureHelp.fs:line 240
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2) in D:\a\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 447
   at <StartupCode$FsAutoComplete-Core>.$CompilerServiceInterface.ParseAndCheckFileInProject@340-11.Invoke(AsyncActivation`1 ctxt) in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete.Core/CompilerServiceInterface.fs:line 340
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in D:\a\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 104
[Error - 18:32:21] Request textDocument/signatureHelp failed.
  Message: Index was outside the bounds of the array.
  Code: -32603 
[18:33:03.450 ERR] [LSP] PositionHandler - Failed during child operation on file <path_omitted>\PmaBolero\src\PmaBolero.Client\Pages\Main.fs
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at <StartupCode$FsAutoComplete-Core>.$FileSystem.TryGetPrevChar@213.Invoke(Position np) in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete.Core/FileSystem.fs:line 213
   at Microsoft.FSharp.Core.OptionModule.Map[T,TResult](FSharpFunc`2 mapping, FSharpOption`1 option) in D:\a\_work\1\s\src\fsharp\FSharp.Core\option.fs:line 53
   at FsAutoComplete.SignatureHelp.loop@231-22(NamedText lines, Char ch, Position pos) in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete.Core/SignatureHelp.fs:line 232
   at FsAutoComplete.SignatureHelp.getSignatureHelpFor@230.Invoke(Unit unitVar) in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete.Core/SignatureHelp.fs:line 240
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2) in D:\a\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 447
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in D:\a\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 104
[Error - 18:33:03] Request textDocument/signatureHelp failed.
  Message: Index was outside the bounds of the array.
  Code: -32603 
[Error - 18:33:17] Request textDocument/signatureHelp failed.
  Message: Index was outside the bounds of the array.
  Code: -32603

Before each crash, the final log in exthost.log would be something akin to:

[2022-06-03 19:10:16.944] [exthost] [info] Extension host terminating: renderer closed the socket
[2022-06-03 19:10:17.019] [exthost] [warning] {"name":"Canceled"}
[2022-06-03 19:10:17.019] [exthost] [warning] {"name":"Canceled"}
[2022-06-03 19:10:17.020] [exthost] [warning] {"name":"Canceled"}
[2022-06-03 19:10:17.066] [exthost] [info] Extension host with pid 11316 exiting with code 0

The exception occurred for various files in PmaBolero\src\PmaBolero.Client\Pages that I was editing yesterday.

I've been able to reproduce the error (by taking a look at the logs) in other repos, but far less frequently and it didn't cause VSCode to crash.

  • OS: Windows
  • .NET SDK version: 6.0.300
  • Ionide version: 6.0.5
@WillEhrendreich
Copy link

I'm seeing this from time to time too, in Neovim on windows, and I'm completely unsure what it's even referring to.

@baronfel
Copy link
Contributor

I believe @Booksbaum has fixed this in one of his more recent contributions, but we haven't released a version of FSAC that contains it yet. I'm busy the next few days with personal things, but I'm hoping to release it over the weekend.

@juergenhoetzel
Copy link
Contributor

Same issue in Emacs eglot-fsharp CI tests:

fsharp/emacs-fsharp-mode#316

Can't reproduce this on my i9 desktop setup. The tests fail reproducibly on an i3 Intel NUC: Seems to be a timing/race-condition.

@Booksbaum
Copy link
Contributor

I believe @Booksbaum has fixed this in one of his more recent contributions, but we haven't released a version of FSAC that contains it yet.

#947 -- which is already in current FSAC & ionide

But this here is a similar issue: Again line comparison of FCS Position with 0 instead of 1:
https://github.com/fsharp/FsAutoComplete/blob/9f58993f9630c8250a9558c60e5ece817c2ccb52/src/FsAutoComplete.Core/FileSystem.fs#L230

I'll submit a PR later today

Booksbaum added a commit to Booksbaum/FsAutoComplete that referenced this issue Jul 2, 2022
Reason: Comparison with line 0 instead of line 1

Note: While Exception with stack trace was shown, there was no impact on actual FSAC usage (-> FSAC didn't crash). Exception was just shown in log

Note: Request still fails because no prev char, but it fails as expected. Previously failure was unwanted failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants