AL icon indicating copy to clipboard operation
AL copied to clipboard

(1,1): error AL0999: Internal error: The type initializer for 'Microsoft.Dynamics.Nav.CodeAnalysis.TriggerDefinitions' threw an exception.

Open lhtan-dev opened this issue 7 years ago • 15 comments

///Description/// Upon compiling extension, package failed to be created with the error in subject. After a few minutes, the below output error gets thrown.

///Version details///* AL 2.1.68304 AL 2.0.56865 Both version is install and enabled. Not sure how. bcinsider.azurecr.io/bcsandbox-master:th

///Output error/// [Error - 7:47:23 PM] Please report this issue to https://github.com/microsoft/al/issues including information on how to reproduce it, if possible. Processing of message 'textDocument/hover' failed with error: 'Position: 707, FullSpan: (0..0) Parameter name: position' Details: System.ArgumentOutOfRangeException: Position: 707, FullSpan: (0..0) Parameter name: position at Microsoft.Dynamics.Nav.CodeAnalysis.SyntaxNode.FindToken(Int32 position) in C:\a\1051\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Syntax\SyntaxNode.cs:line 896 at Microsoft.Dynamics.Nav.CodeAnalysis.Workspaces.DocumentExtensions.<GetTokenAtPositionAsync>d__18.MoveNext() in C:\a\1051\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis.Workspaces\Shared\Extensions\DocumentExtensions.cs:line 332 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Dynamics.Nav.CodeAnalysis.Workspaces.DocumentExtensions.<IsPositionNotOnTokenTrivia>d__7.MoveNext() in C:\a\1051\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis.Workspaces\Shared\Extensions\DocumentExtensions.cs:line 168 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Dynamics.Nav.EditorServices.Protocol.LanguageServer.HoverRequestHandler.<HandleAsync>d__3.MoveNext() in C:\a\1051\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\LanguageServer\HoverRequestHandler.cs:line 40 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Dynamics.Nav.EditorServices.Protocol.MessageProtocol.RequestHandlerBase1.<HandleAsync>d__10.MoveNext() in C:\a\1051\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\MessageProtocol\RequestHandlerBase.cs:line 45 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Dynamics.Nav.EditorServices.Protocol.RequestRegistry.<Process>d__6.MoveNext() in C:\a\1051\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\Endpoints\RequestRegistry.cs:line 58

lhtan-dev avatar Dec 03 '18 12:12 lhtan-dev

Hi @lhtan-dev, are you using a workspace with multiple AL projects?

qutreson avatar Dec 03 '18 13:12 qutreson

Nope. Just a single project.

lhtan-dev avatar Dec 03 '18 13:12 lhtan-dev

Can you also disable successively one of the two AL extensions you have installed to see if it fixes your issue? You should always have one AL extension enabled at the time in VS Code. If that still reproduces with AL 2.1.68304, looking at the stack trace, the error seems to come from hovering over something in your project. Can you try finding out some code snippet that would reproduce the issue?

qutreson avatar Dec 03 '18 14:12 qutreson

Disabled AL 2.1 and the project builds successfully. //AL 2.0 is working fine.

DIsabled AL 2.0 and the project fails to build. //AL 2.1 is the one with the issue. AL 2.1 is the vsix that comes with the docker image.

image

lhtan-dev avatar Dec 03 '18 14:12 lhtan-dev

Minutes later, this pops up. 7 of these errors to be exact. With all pointing to System.ArgumentOutOfRangeException : Position <#>

  • Position : 105
  • Position : 7
  • Position : 10
  • Position : 7
  • Position : 3
  • Position : 4
  • Position : 3

image

lhtan-dev avatar Dec 03 '18 14:12 lhtan-dev

Can you provide us with some code that reproduces this issue?

qutreson avatar Dec 03 '18 15:12 qutreson

      Can you provide us with some code that reproduces this issue?

I've created a fresh new project and the error still persist. Here's the code of HelloWorld.al and picture snippet of the error.

`// Welcome to your new AL extension. // Remember that object names and IDs should be unique across all extensions. // AL snippets start with t*, like tpageext - give them a try and happy coding!

pageextension 50100 CustomerListExt extends "Customer List" { trigger OnOpenPage(); begin Message('App published: Hello world'); end; }`

image

lhtan-dev avatar Dec 04 '18 05:12 lhtan-dev

      Can you provide us with some code that reproduces this issue?

Would you like to connect so i can share the environment access?

lhtan-dev avatar Dec 05 '18 14:12 lhtan-dev

Hi @lhtan-dev ! Could you try the following:

  1. Uninstall the AL Language extension from VSCode.
  2. Restart VSCode
  3. Go to C:\Users{YourUserName}.vscode\extensions
  4. Delete all the folders that are related to the AL Language extension. They should be similar to microsoft.al-2.1.0
  5. Restart your environment
  6. Install the latest AL Language extension from the marketplace.
  7. Restart VSCode
  8. Open your project.

atoader avatar Dec 11 '18 06:12 atoader

I have the same problem. I've updated to the latest insider build and tried to create a new project. The following error occurs immediately after downloading the symbols:

(1,1): error AL0999: Internal error: Der Typeninitialisierer für "Microsoft.Dynamics.Nav.CodeAnalysis.TriggerDefinitions" hat eine Ausnahme verursacht.

Image: bcinsider.azurecr.io/bcsandbox-master:de-ltsc2016 AL Language: 2.1.73375 VS Code: 1.30.0

Hi @lhtan-dev ! Could you try the following:

  1. Uninstall the AL Language extension from VSCode.
  2. Restart VSCode
  3. Go to C:\Users{YourUserName}.vscode\extensions
  4. Delete all the folders that are related to the AL Language extension. They should be similar to microsoft.al-2.1.0
  5. Restart your environment
  6. Install the latest AL Language extension from the marketplace.
  7. Restart VSCode
  8. Open your project.

Does not work for me. Build fails with the following error:

vscode-error

kwettermann avatar Dec 17 '18 10:12 kwettermann

Hi @kwettermann ! Is it the build that is failing or publishing to the server?

atoader avatar Dec 17 '18 18:12 atoader

@kwettermann it seems that you are using an extension that is older than what your server can support. If you are using a docker development preview, you should use the AL Language extension that comes with the docker image. If you are using a docker of a released version of BC 13, you should use the latest extension from the marketplace. We have updated the extension today, so make sure to update as well.

atoader avatar Dec 21 '18 09:12 atoader

@kwettermann it seems that you are using an extension that is older than what your server can support. If you are using a docker development preview, you should use the AL Language extension that comes with the docker image. If you are using a docker of a released version of BC 13, you should use the latest extension from the marketplace. We have updated the extension today, so make sure to update as well.

Works now. Thank you.

kwettermann avatar Jan 02 '19 10:01 kwettermann

I'm having the same problem, I've downlaoded the last AL extension from the market, and error. I've isntalled the extension from the vsix of the docker, and error. I'm also trying to redownlaod the symbols, and I get this error: [Error - 12:03:27 PM] Please report this issue to https://github.com/microsoft/al/issues including information on how to reproduce it, if possible. Processing of message 'al/downloadSymbols' failed with error: 'Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.' Details: System.IO.FileNotFoundException: Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. File name: 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' at Microsoft.Dynamics.Nav.EditorServices.Protocol.LanguageServer.Extensions.NavServerRequestHandler1.d__5.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine) at Microsoft.Dynamics.Nav.EditorServices.Protocol.LanguageServer.Extensions.NavServerRequestHandler1.HandleAsync(T request, Int32 requestId, CancellationToken cancellationToken) at Microsoft.Dynamics.Nav.EditorServices.Protocol.MessageProtocol.RequestHandlerBase1.d__9.MoveNext() in F:\a\8\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\MessageProtocol\RequestHandlerBase.cs:line 43 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Dynamics.Nav.EditorServices.Protocol.RequestRegistry.d__6.MoveNext() in F:\a\8\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\Endpoints\RequestRegistry.cs:line 64

WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

[Error - 12:03:53 PM] Please report this issue to https://github.com/microsoft/al/issues including information on how to reproduce it, if possible. Processing of message 'textDocument/hover' failed with error: 'Position: 950, FullSpan: (0..0) Parameter name: position' Details: System.ArgumentOutOfRangeException: Position: 950, FullSpan: (0..0) Parameter name: position at Microsoft.Dynamics.Nav.CodeAnalysis.SyntaxNode.FindToken(Int32 position) in F:\a\8\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Syntax\SyntaxNode.cs:line 763 at Microsoft.Dynamics.Nav.CodeAnalysis.Workspaces.DocumentExtensions.d__19.MoveNext() in F:\a\8\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis.Workspaces\Shared\Extensions\DocumentExtensions.cs:line 360 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Dynamics.Nav.CodeAnalysis.Workspaces.DocumentExtensions.d__7.MoveNext() in F:\a\8\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis.Workspaces\Shared\Extensions\DocumentExtensions.cs:line 164 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Dynamics.Nav.EditorServices.Protocol.LanguageServer.HoverRequestHandler.d__3.MoveNext() in F:\a\8\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\LanguageServer\HoverRequestHandler.cs:line 44 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Dynamics.Nav.EditorServices.Protocol.MessageProtocol.RequestHandlerBase`1.d__9.MoveNext() in F:\a\8\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\MessageProtocol\RequestHandlerBase.cs:line 43 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Dynamics.Nav.EditorServices.Protocol.RequestRegistry.d__6.MoveNext() in F:\a\8\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\Endpoints\RequestRegistry.cs:line 64

`

aetxebarria avatar Apr 09 '19 10:04 aetxebarria

@aetxebarria the stacktrace appears to be different. I think your issue was caused by not having .NET Framework 4.7.2 installed.

atoader avatar Aug 10 '19 20:08 atoader