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

Go to definition on a standard object: "A request has failed" #6

Closed
NKarolak opened this issue Oct 15, 2020 · 5 comments
Closed

Go to definition on a standard object: "A request has failed" #6

NKarolak opened this issue Oct 15, 2020 · 5 comments
Assignees
Labels
bug Something isn't working ships-in-beta
Milestone

Comments

@NKarolak
Copy link

NKarolak commented Oct 15, 2020

An error is thrown from the AL Language extension actually, but I can reproduce it only with AL Studio involved.
Can you confirm it is a mere AL Language error?

I am developing an extension depending on the Base Application.

  1. In AL Home, go to table 36, and click on the name "Sales Header".
  2. In the Fields page, click on "Source".
  3. Go to field 1, and try F12 on Enum "Sales Document Type".
  4. Error: "A request has failed. See the output for more information."

Output AL:

[Error - 13:02:05] Please report this issue to https://github.com/microsoft/al/issues including information on how to reproduce it, if possible.
Processing of message 'al/gotodefinition' failed with error: 'Index was outside the bounds of the array.'
Details:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Microsoft.Dynamics.Nav.EditorServices.Protocol.FilePathHelper.ParsePreviewFileUrl(Uri uri) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\FilePathHelper.cs:line 97
   at Microsoft.Dynamics.Nav.EditorServices.Protocol.LanguageServer.ReferenceSymbolDefinitionManager.GetDeclaringSymbolAsync(Uri previewUri, CancellationToken token) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\LanguageServer\ReferenceSymbolDefinitionManager.cs:line 137
   at Microsoft.Dynamics.Nav.EditorServices.Protocol.LanguageServer.ReferenceSymbolDefinitionManager.GetContentAsync(Uri previewUri, LaunchConfiguration configuration, CancellationToken token, Boolean relyOnCachedValue) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\LanguageServer\ReferenceSymbolDefinitionManager.cs:line 73
   at Microsoft.Dynamics.Nav.EditorServices.Protocol.LanguageServer.ReferenceSymbolDefinitionManager.GetDefinitionForSymbolAtPositionAsync(Uri previewUri, Position requestPosition, LaunchConfiguration configuration, CancellationToken cancellationToken) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\LanguageServer\ReferenceSymbolDefinitionManager.cs:line 101
   at Microsoft.Dynamics.Nav.EditorServices.Protocol.LanguageServer.Extensions.AlDefinitionRequestHandler.ProcessRequestAsync(AlDefinitionRequest request, Int32 requestId, CancellationToken cancellationToken) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\LanguageServer\Extensions\AlDefinitionRequestHandler.cs:line 50
   at Microsoft.Dynamics.Nav.EditorServices.Protocol.LanguageServer.Extensions.NavServerRequestHandler`2.HandleAsync(T request, Int32 requestId, CancellationToken cancellationToken) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\LanguageServer\Extensions\NavServerRequestHandler.cs:line 40
   at Microsoft.Dynamics.Nav.EditorServices.Protocol.MessageProtocol.RequestHandlerBase`1.HandleAsync(JToken requestContents, Int32 requestId, CancellationToken cancellationToken) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\MessageProtocol\RequestHandlerBase.cs:line 65
   at Microsoft.Dynamics.Nav.EditorServices.Protocol.RequestRegistry.Process(Message message) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\Endpoints\RequestRegistry.cs:line 80

If I disable AL Studio and open the Sales Header.dal (which btw does not include code, just the fields) and press F12 on the enum, it just says "No definition found for ...". But no unhandled error logged.

@martonsagi
Copy link
Contributor

I have never been satisfied with the DAL thing, therefore I have created a custom document provider for loading source code from Symbol packages.
Unfortunately, AL Language extension does not support navigation within DAL/any other AL-like virtual files, hence the exception above. AL Studio's custom provider only amplifies this underlying issue.

There is a Definition Provider in AL Object Designer that I'm intending to port to AL Studio as well, see demo here:
https://twitter.com/sagimarton/status/1246219307689836545
This should resolve the exception.. at least I did not experience it while using AL Object Designer.

@martonsagi
Copy link
Contributor

Good news: I was able to stop generating AL Language exceptions by applying some changes on my side.

So, it will work like this in the next beta (next week):
ALStudio_DefinitionProvider

@martonsagi martonsagi self-assigned this Oct 16, 2020
@martonsagi martonsagi added bug Something isn't working ships-in-beta labels Oct 16, 2020
@martonsagi martonsagi added this to the v1.0 milestone Oct 16, 2020
@NKarolak
Copy link
Author

Cool, thanks!

@NKarolak
Copy link
Author

Confirmed in preview version 0.9.559 - veeeery nice :-)

@martonsagi
Copy link
Contributor

Thank you for the confirmation! If #5 also works, I'm ready to publish the new beta. :)

(You can try placing breakpoints, that should also work - although the red dot is not yet visible while debugging, but it stops at the breakpoints)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ships-in-beta
Projects
None yet
Development

No branches or pull requests

2 participants