TypeCobolTeam / TypeCobol

TypeCobol is an Incremental Cobol parser for IBM Enterprise Cobol 6 for zOS syntax. TypeCobol is also an extension of Cobol 85 language which can then be converted to Cobol85.
Other
78 stars 26 forks source link

Exception FailRange in incremental mode #2130

Open smedilol opened 2 years ago

smedilol commented 2 years ago

Describe the bug Frequent exception when modifying Cobol source code. This seems to happen when you delete the whole source and change it (Ctrl +A, paste new source code).

L'argument spécifié n'était pas dans les limites de la plage des valeurs valides. 
Nom du paramètre : index 
à TypeCobol.Compiler.Concurrency.Requires.FailRange(String parameterName, String message)
   à TypeCobol.Compiler.Concurrency.ImmutableList`1.Node.Insert(Int32 index, T key)
   à TypeCobol.Compiler.CompilationDocument.UpdateTextLines(TextChangedEvent textChangedEvent)
   à TypeCobol.LanguageServer.Workspace.UpdateSourceFile(Uri fileUri, TextChangedEvent textChangedEvent)
   à TypeCobol.LanguageServer.TypeCobolServer.OnDidChangeTextDocument(DidChangeTextDocumentParams parameters)
   à TypeCobol.LanguageServer.VsCodeProtocol.LanguageServer.CallDidChangeTextDocument(NotificationType notificationType, Object parameters)

Expected behavior If not possible to fix it, check if possible to resynchronize the whole document.

EDIT: It happened 9 times on 2022/04/27 for one user.

fm-117 commented 2 years ago

4 new occurences on 2022/08/17

smedilol commented 1 year ago

Bug didn't happen for a long time. It should have been fixed by PR #2160 (WI #2157)

fm-117 commented 5 months ago

1 new case on 2024/03/26 with the following stack trace:

Specified argument was out of the range of valid values. (Parameter 'index')
at TypeCobol.Compiler.Concurrency.Requires.FailRange(String parameterName, String message)
at TypeCobol.Compiler.Concurrency.ImmutableList`1.Node.ReplaceAt(Int32 index, T value)
at TypeCobol.Compiler.CompilationDocument.ApplyTextChange(TextChange textChange, IList`1 documentChanges)
at TypeCobol.Compiler.CompilationDocument.<UpdateTextLines>g__InsertOrUpdate|35_0(TextChangeType type, <>c__DisplayClass35_0& , <>c__DisplayClass35_1& , <>c__DisplayClass35_2& , <>c__DisplayClass35_3& )
at TypeCobol.Compiler.CompilationDocument.UpdateTextLines(RangeUpdate[] updates)
at TypeCobol.LanguageServer.Workspace.UpdateSourceFile(Uri fileUri, RangeUpdate[] updates)
at TypeCobol.LanguageServer.TypeCobolServer.OnDidChangeTextDocument(DidChangeTextDocumentParams parameters)
at TypeCobol.LanguageServer.VsCodeProtocol.LanguageServer.CallDidChangeTextDocument(NotificationType notificationType, Object parameters, LSPProfiling lspProfiling)