AL icon indicating copy to clipboard operation
AL copied to clipboard

NullException by git checkout with a multiproject workspace

Open AndyF2k25 opened this issue 7 years ago • 9 comments

Describe the bug Get an error when using "git checkout" on a multiproject workspace right after opening VSCode.

[Error - 10:28:18] Please report this issue to https://github.com/microsoft/al/issues including information on how to reproduce it, if possible.
Processing of message 'workspace/didChangeWatchedFiles' failed with error: 'Der Wert darf nicht NULL sein.
Parametername: projectId'
Details:
System.ArgumentNullException: Der Wert darf nicht NULL sein.
Parametername: projectId
   bei Microsoft.Dynamics.Nav.CodeAnalysis.Workspaces.DocumentId.CreateNewId(ProjectId projectId, String debugName) in F:\a\460\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis.Workspaces\Workspace\Solution\DocumentId.cs:Zeile 74.
   bei Microsoft.Dynamics.Nav.EditorServices.Protocol.BufferManager.TryAddTransientDocument(String filePath, String text, Boolean handleRad, DocumentId& documentId) in F:\a\460\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\BufferManager.cs:Zeile 177.
   bei Microsoft.Dynamics.Nav.EditorServices.Protocol.LanguageServer.DidChangeWatchedFilesRequestHandler.HandleAsync(DidChangeWatchedFilesRequest request, Int32 requestId, CancellationToken cancellationToken) in F:\a\460\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\LanguageServer\DidChangeWatchedFilesRequestHandler.cs:Zeile 30.
   bei Microsoft.Dynamics.Nav.EditorServices.Protocol.MessageProtocol.RequestHandlerBase`1.<HandleAsync>d__9.MoveNext() in F:\a\460\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\MessageProtocol\RequestHandlerBase.cs:Zeile 43.
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei Microsoft.Dynamics.Nav.EditorServices.Protocol.RequestRegistry.<Process>d__6.MoveNext() in F:\a\460\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\Endpoints\RequestRegistry.cs:Zeile 64.

To Reproduce

  1. Open a .workspace-file from VSCode with more than one AL-Project.
  2. Checkout a different branch than your current one with "git checkout [branchname]". I even can reproduce the bug by using the "Checkout To"-Action from my source control.
  3. Exception is thrown.

Expected behavior The error should not be thrown. I am not sure what is effected by the error, but from time to time VSCode shows some warning/errors in my project B that objects from my project A "does not contain a definition", but they do. Already discussed here: https://www.yammer.com/dynamicsnavdev/threads/361551778758656. Not sure if this error is related to this behavior.

5. Versions:

  • AL Language: 4.0.176004
  • Business Central: Plattform 15.0.36510.0 + Anwendung 15.0.36590.0 (docker hosted)

AndyF2k25 avatar Oct 25 '19 08:10 AndyF2k25

Hi! What is different between the two branches?

atoader avatar Oct 25 '19 17:10 atoader

The only differences are that the branch I want to check out is not available on remote and is behind the current branch. Not sure what happens if the remote branch still exists. Cannot check it right now.

AndyF2k25 avatar Oct 25 '19 17:10 AndyF2k25

Hi @AndreasGloeckner thank you for reporting the issue. I tried to reproduce it using your steps with no success. We recently worked on something similar, could try to reproduce it with the latest AL Extension from the market place. If it is still there, could you please attach a workspace demonstrating the issue. Do you have any active files opened (from one or from both projects?) while you are switching branches? Thanks.

AndreyKorepanov avatar Oct 28 '19 09:10 AndreyKorepanov

Hi @AndreyKorepanov. I installed the latest verison from the marketplace (4.0.19.1880) and deactivated the old version. Nevertheless, I still get the exception. No files were opened in the same or another instance of VSCode.

Tested following scenarios:

  1. Open one folder, checkout another branch => no error
  2. Open one folder, add another project, checkout another branch => no error
  3. Open one folder, add two other projects, ceckout another branch => no error. This is nearly the same initial situation unless I added the folders manually.
  4. I open the original saved .code-workspace file with the three projects from step 3. Checkout a branch => Error occurs.

Then I created the same workspace again (see step 3). Saved it. Closed VSCode. Opened the .code-workspace and checkout another branch => no error.

I compared the workspaces: They are identical. Don't know what's the cause...

See here (had to rename the file extension): Test.txt

AndyF2k25 avatar Oct 28 '19 14:10 AndyF2k25

Hi @AndreasGloeckner, it seems the problem is with the documents added in the branch you are switching to. We'll take care of it. Meanwhile a workspace reloading should be a quick workaround.

AndreyKorepanov avatar Oct 29 '19 14:10 AndreyKorepanov

Sorry, but what documents? You mean the files in my projects? And why does it work if I create the same workspace again?

AndyF2k25 avatar Oct 30 '19 15:10 AndyF2k25

Are there any news? Still got the error with VSCode Version 1.42.1 and AL Language 4.0.206840.

AndyF2k25 avatar Feb 19 '20 07:02 AndyF2k25

This issue has been added to our backlog, but we cannot provide an estimate of when we will actively start working on it.

qutreson avatar Jun 30 '20 06:06 qutreson

Hi,

Many thanks for raising this issue. Unfortunately we have not been able to get to this issue as soon as we'd have liked. Since it has been a long time since this issue was last updated, it is possible that this has been fixed by a newer release of Business Central and the AL extension for Visual Studio Code. We have thus decided to close it.

If the issue still affects you on the latest insider build of Business Central, please help us and open a new issue for us with the latest steps to reproduce the issue, and link back to this closed issue to track any comments or discussions.

Thanks,
Thaddeus

github-actions[bot] avatar Jan 31 '22 02:01 github-actions[bot]