System.ArgumentNullException: Value cannot be null. (Parameter 'projectId')
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:

I'm working in a multi-root workspace..
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.
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!