anzwdev / al-code-outline

AL Code Outline for Visual Studio Code
MIT License
51 stars 13 forks source link

Symbols Browser - Go to definition (project file or server definition) #275

Closed GreatScott000 closed 2 years ago

GreatScott000 commented 3 years ago

More often than not I get this error when trying to go to a definition in Base App. image I double click the object, select my launch configuration and then the error appears. Sometimes it works but most of the time it doesn't. This has been happening for a while.

What am I doing wrong? What more information can I provide to assist in investigating the issue?

AZ AL Dev Tools version 3.0.16

anzwdev commented 3 years ago

Hi.

Is it broken for all object types? Do you see any errors if you run "Open AZ AL Dev Tools Log File"? To which version of BC are you deploying your code? Is it BC18 or something older? Are you using Microsoft AL Extension from VS Code marketplace or from VSIX file? Do you have just 1 base app file in your .alpackages folder?

You should not see this error message at all. It is old "go to definition" functionality that I've decided to leave here just in case the new, faster logic breaks.

GreatScott000 commented 3 years ago

Sorry, I have been on annual leave. Let me review this and I will get back to you.

GreatScott000 commented 3 years ago

I went to do some testing today and it seems to be working at the moment. Yesterday it was not. I will continue to monitor.

GreatScott000 commented 3 years ago

It is not working today on my laptop. I have tried pages, reports, codeunits and tables

It worked fine all day yesterday on my PC. But I can't check because I had to come into the office today.

Here is the log file.

2021-09-30 08:03:24.579 [ERROR] tid:7 in 'LogError' C:\Projects\GitHub\az-al-dev-tools-server\AZALDevToolsServer\AnZwDev.VSCodeLangServer\Protocol\MessageProtocol\AbstractMessageHandler.cs: line 30 Error: Object reference not set to an instance of an object. at AnZwDev.ALTools.ALSymbols.ALSymbolsLibrary.GetObjectsTree() in C:\Projects\GitHub\az-al-dev-tools-server\AZALDevToolsServer\Shared.AnZwDev.ALTools\ALSymbols\ALSymbolsLibrary.cs:line 32 at AnZwDev.ALTools.Server.Handlers.AppPackageSymbolsRequestHandler.HandleMessage(AppPackageSymbolsRequest parameters, RequestContext`1 context) in C:\Projects\GitHub\az-al-dev-tools-server\AZALDevToolsServer\Shared.AnZwDev.ALTools.Server\Handlers\AppPackageSymbolsRequestHandler.cs:line 40

2021-09-30 08:05:33.537 [ERROR] tid:7 in 'LogError' C:\Projects\GitHub\az-al-dev-tools-server\AZALDevToolsServer\AnZwDev.VSCodeLangServer\Protocol\MessageProtocol\AbstractMessageHandler.cs: line 30 Error: Object reference not set to an instance of an object. at AnZwDev.ALTools.ALSymbols.ALSymbolsLibrary.GetObjectsTree() in C:\Projects\GitHub\az-al-dev-tools-server\AZALDevToolsServer\Shared.AnZwDev.ALTools\ALSymbols\ALSymbolsLibrary.cs:line 32 at AnZwDev.ALTools.Server.Handlers.AppPackageSymbolsRequestHandler.HandleMessage(AppPackageSymbolsRequest parameters, RequestContext`1 context) in C:\Projects\GitHub\az-al-dev-tools-server\AZALDevToolsServer\Shared.AnZwDev.ALTools.Server\Handlers\AppPackageSymbolsRequestHandler.cs:line 40

GreatScott000 commented 3 years ago

Hmm, okay so I was getting this message

cannot open al-preview://allang/BC%20Extension/Table/3/Payment%20Terms.dal. Detail: Unable to resolve text model content for resource al-preview://allang/BC%20Extension/Table/3/Payment%20Terms.dal

and then redownloaded symbols and it now works.

The first issue this morning was maybe related to my container (Docker Desktop) was not fully started. Can you determine if it is a communication error and include that in the messaging?

anzwdev commented 3 years ago

Thank you for checki it. I've modified a bit code of the extension to handle these NullReference execeptions. They look like a problems with opening *.app files.

Unfortunately I cannot do much with your second problem. I am just building the path and then I call standard "open document" functionality. "al-preview" protocol is implemented by Microsoft AL extension and it connects to the server, downloads source code and shows the file.

GreatScott000 commented 2 years ago

Getting this error today trying to go to definition. "Pag.al" is my currently open object file. Why is being accessed and why it is a problem?

2021-11-29 15:15:55.023 [ERROR] tid:5 in 'HandleRawMessage' C:\Projects\GitHub\az-al-dev-tools-server\AZALDevToolsServer\AnZwDev.VSCodeLangServer\Protocol\MessageProtocol\NotificationHandler.cs: line 36 Error: The process cannot access the file 'd:\Repos\evolveims\evol001\Shelfware\LeaveManagement\src\pag.al' because it is being used by another process. at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle) at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize) at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks) at System.IO.File.InternalReadAllText(String path, Encoding encoding) at System.IO.File.ReadAllText(String path) at AnZwDev.ALTools.Workspace.ALProjectFile.CompileSymbolReferences(Boolean cleanDirtyState) in C:\Projects\GitHub\az-al-dev-tools-server\AZALDevToolsServer\Shared.AnZwDev.ALTools\Workspace\ALProjectFile.cs:line 101 at AnZwDev.ALTools.Server.Handlers.ChangeTracking.FileSystemFileChangeNotificationHandler.HandleNotification(FileSystemChangeNotificationRequest parameters, NotificationContext context) in C:\Projects\GitHub\az-al-dev-tools-server\AZALDevToolsServer\Shared.AnZwDev.ALTools.Server\Handlers\ChangeTracking\FileSystemFileChangeNotificationHandler.cs:line 23 at AnZwDev.VSCodeLangServer.Protocol.MessageProtocol.NotificationHandler`1.HandleRawMessage(Message notificationMessage, MessageWriter messageWriter) in C:\Projects\GitHub\az-al-dev-tools-server\AZALDevToolsServer\AnZwDev.VSCodeLangServer\Protocol\MessageProtocol\NotificationHandler.cs:line 38

anzwdev commented 2 years ago

Hi

I'll check it. My extension monitors file changes to collect symbol information in the current project, but it should not access file when you run go to definition.

anzwdev commented 2 years ago

Hi

I've released a new version of the extension, it contains a fix preventing your file read/locks issue.