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

System.ArgumentOutOfRangeException: Position is not within syntax tree with full span (33573..33606) (Parameter 'position') #7966

Open
2 tasks
coffeecup007 opened this issue Feb 11, 2025 · 0 comments

Comments

@coffeecup007
Copy link

Please include the following with each issue:

1. Describe the bug

This stack trace occurs:

Please report this issue to https://github.com/microsoft/al/issues including information on how to reproduce it, if possible.
Processing of message 'textDocument/semanticTokens/full' failed with error: 'Position is not within syntax tree with full span (33573..33606) (Parameter 'position')
Actual value was 33296.'
Details:

System.ArgumentOutOfRangeException: Position is not within syntax tree with full span (33573..33606) (Parameter 'position')
Actual value was 33296.
at Microsoft.Dynamics.Nav.CodeAnalysis.SemanticModel.CheckAndAdjustPosition(Int32 position, SyntaxToken& token) in X:\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compilation\SemanticModel.cs:line 1692
at Microsoft.Dynamics.Nav.CodeAnalysis.SemanticModel.GetAdjustedNodePosition(SyntaxNode node) in X:\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compilation\SemanticModel.cs:line 1636
at Microsoft.Dynamics.Nav.CodeAnalysis.MemberSemanticModel.GetBoundNodes(SyntaxNode node) in X:\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compilation\MemberSemanticModel.cs:line 374
at Microsoft.Dynamics.Nav.CodeAnalysis.MemberSemanticModel.GetBoundNodes(SyntaxNode node, SyntaxNode& bindableNode, BoundNode& lowestBoundNode, BoundNode& highestBoundNode, BoundNode& boundParent) in X:\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compilation\MemberSemanticModel.cs:line 161
at Microsoft.Dynamics.Nav.CodeAnalysis.MemberSemanticModel.GetSymbolInfoWorker(SyntaxNode node, CancellationToken cancellationToken) in X:\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compilation\MemberSemanticModel.cs:line 81
at Microsoft.Dynamics.Nav.CodeAnalysis.SyntaxTreeSemanticModel.GetSymbolInfoWorker(SyntaxNode node, CancellationToken cancellationToken) in X:\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compilation\SyntaxTreeSemanticModel.cs:line 95
at Microsoft.Dynamics.Nav.CodeAnalysis.SemanticModel.GetSymbolInfo(ExpressionSyntax expression, CancellationToken cancellationToken) in X:\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compilation\SemanticModel.cs:line 551
at Microsoft.Dynamics.Nav.CodeAnalysis.Workspaces.Classification.AbstractClassificationService.Worker.ClassifyNode(SyntaxNode syntax) in X:\Prod\Microsoft.Dynamics.Nav.CodeAnalysis.Workspaces\Classification\AbstractClassificationService.Worker.cs:line 126
at Microsoft.Dynamics.Nav.CodeAnalysis.Workspaces.Classification.AbstractClassificationService.Worker.Classify(Workspace workspace, SemanticModel semanticModel, TextSpan textSpan, List1 list, Func2 getNodeClassifiers, Func2 getTokenClassifiers, CancellationToken cancellationToken) in X:\Prod\Microsoft.Dynamics.Nav.CodeAnalysis.Workspaces\Classification\AbstractClassificationService.Worker.cs:line 69 at Microsoft.Dynamics.Nav.CodeAnalysis.Workspaces.Classification.Classifier.GetClassifiedSpans(SemanticModel semanticModel, TextSpan textSpan, Workspace workspace, CancellationToken cancellationToken) in X:\Prod\Microsoft.Dynamics.Nav.CodeAnalysis.Workspaces\Classification\Classifier.cs:line 48 at Microsoft.Dynamics.Nav.CodeAnalysis.Workspaces.Classification.Classifier.GetClassifiedSpansAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken) in X:\Prod\Microsoft.Dynamics.Nav.CodeAnalysis.Workspaces\Classification\Classifier.cs:line 27 at Microsoft.Dynamics.Nav.EditorServices.Protocol.LanguageServer.SemanticTokensFullRequestHandler.HandleAsync(SemanticTokensRequest request, Int32 requestId, CancellationToken cancellationToken) in X:\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\LanguageServer\SemanticTokensFullRequestHandler.cs:line 49 at Microsoft.Dynamics.Nav.EditorServices.Protocol.MessageProtocol.RequestHandlerBase1.HandleAsync(JToken requestContents, Int32 requestId, CancellationToken cancellationToken) in X:\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\MessageProtocol\RequestHandlerBase.cs:line 84
at Microsoft.Dynamics.Nav.EditorServices.Protocol.RequestRegistry.Process(Message message) in X:\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\Endpoints\RequestRegistry.cs:line 84

2. To Reproduce
Steps to reproduce the behavior:

  1. Open VS code, compile the project.
  2. Unfortunately the project is proprietary, contains hundreds of files, and can not be published here. The project compiles, deploys, has no warnings nor build errors, and runs fine.
  3. This was not an issue with the previous VSIX for BC and previous version of VSCode. This has only recently become an issue.

Simplifying the code has been attempted, but it's not clear which file or syntax is causing this issue.

Proprietary.  Unfortunately not able to share, nor is it clear which file is causing the issue (there are hundreds of files in this project).

3. Expected behavior
No crash.

4. Actual behavior
A crash.

5. Versions:

  • AL Language: 14.0
  • Visual Studio Code: 1.96.4
  • Business Central:25.1
  • List of Visual Studio Code extensions that you have installed:
  • Gitlens
  • GitHub Copilot for Azure
  • Code Spell Checker
  • "AL Language extension for Microsoft Dynamics 365 Business Central
  • Operating System:
    • [ * ] Windows
    • Linux
    • MacOS

Final Checklist

Please remember to do the following:

  • [* ] Search the issue repository to ensure you are reporting a new issue

  • [ *] Reproduce the issue after disabling all extensions except the AL Language extension

  • [ *] Simplify your code around the issue to better isolate the problem

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

1 participant