AL icon indicating copy to clipboard operation
AL copied to clipboard

System.ArgumentNullException: Value cannot be null. (Parameter 'projectId')

Open waldo1001 opened this issue 5 years ago • 2 comments

I'm getting this error quite a lot lately:

System.ArgumentNullException: Value cannot be null. (Parameter 'projectId')
   at Microsoft.Dynamics.Nav.CodeAnalysis.Workspaces.DocumentId.CreateNewId(ProjectId projectId, String debugName) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis.Workspaces\Workspace\Solution\DocumentId.cs:line 77
   at Microsoft.Dynamics.Nav.EditorServices.Protocol.BufferManager.TryAddTransientDocument(String filePath, String text, Boolean handleRad, DocumentId& documentId) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\BufferManager.cs:line 191
   at Microsoft.Dynamics.Nav.EditorServices.Protocol.LanguageServer.DidChangeWatchedFilesRequestHandler.HandleAsync(DidChangeWatchedFilesRequest request, Int32 requestId, CancellationToken cancellationToken) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\LanguageServer\DidChangeWatchedFilesRequestHandler.cs:line 30
   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

version: image

I'm working in a multi-root workspace..

waldo1001 avatar Jul 02 '21 06:07 waldo1001

I had the same issue today, also in multi-root workspace. Appears to trigger when AL files are created or moved outside of project folders, but are still within the workplace. Moving file into correct project resolved it.

JuricaB avatar Jul 19 '21 02:07 JuricaB

Hi! Thank you for reporting this ArgumentNullException — crash reports with stack traces are always valuable.

We can confirm this class of NRE in document handlers was addressed internally (PR 36826), shipped in Business Central runtime 16.0 (2020 Wave 1). The language server's null handling has been significantly improved since then.

We're closing this as resolved. If you encounter similar exceptions on a current version, please open a new issue with the error details.

Thank you for helping us improve the AL developer experience!

SBalslev avatar Mar 16 '26 11:03 SBalslev