Closed OSHK closed 5 years ago
Got similar error in VS Code editor (problems view and also packaging output log) when using SetRange and SetFilter on field named Name or Id in page extension.
AL extension: al-2.1.79379.
// In page extension. In codeunit it works fine.
// Raises an error.
local procedure Test1()
var
GenJnlBatch: Record "Gen. Journal Batch";
begin
GenJnlBatch.SetFilter(Id, '');
end;
// Raises an error.
local procedure Test2()
var
GenJnlBatch: Record "Gen. Journal Batch";
begin
GenJnlBatch.SetFilter(Name, '');
end;
// No errors.
local procedure Test3()
var
GenJnlBatch: Record "Gen. Journal Batch";
begin
GenJnlBatch.SetFilter(Description, '');
end;
Processing of message 'textDocument/hover' failed with error: 'Unexpected value 'Property' of type 'Microsoft.Dynamics.Nav.CodeAnalysis.SymbolKind''
Details:
System.InvalidOperationException: Unexpected value 'Property' of type 'Microsoft.Dynamics.Nav.CodeAnalysis.SymbolKind'
at Microsoft.Dynamics.Nav.CodeAnalysis.Binder.BindNonMethod(NameSyntax node, Symbol symbol, Boolean isError, BoundExpression receiver) in C:\a\42\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Binder\Binder_Expressions.cs:line 1374
at Microsoft.Dynamics.Nav.CodeAnalysis.Binder.BindIdentifier(IdentifierNameSyntax node, Boolean invoked, DiagnosticBag diagnostics) in C:\a\42\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Binder\Binder_Expressions.cs:line 1014
at Microsoft.Dynamics.Nav.CodeAnalysis.Binder.BindArgumentAndName(AnalyzedArguments result, Boolean hadError, ExpressionSyntax argumentExpression) in C:\a\42\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Binder\Binder_Expressions.cs:line 1159
at Microsoft.Dynamics.Nav.CodeAnalysis.Binder.BindArgumentsAndNames(SeparatedSyntaxList`1 arguments, AnalyzedArguments result) in C:\a\42\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Binder\Binder_Expressions.cs:line 1139
at Microsoft.Dynamics.Nav.CodeAnalysis.Binder.BindInvocationExpression(InvocationExpressionSyntax node, DiagnosticBag diagnostics, Boolean isStatement) in C:\a\42\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Binder\Binder_Invocation.cs:line 31
at Microsoft.Dynamics.Nav.CodeAnalysis.Binder.BindExpressionStatement(SyntaxNode node, ExpressionSyntax syntax, Boolean allowsAnyExpression, DiagnosticBag diagnostics) in C:\a\42\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Binder\Binder_Statements.cs:line 521
at Microsoft.Dynamics.Nav.CodeAnalysis.Binder.BindStatement(StatementSyntax node, DiagnosticBag diagnostics) in C:\a\42\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Binder\Binder_Statements.cs:line 83
at Microsoft.Dynamics.Nav.CodeAnalysis.MemberSemanticModel.IncrementalBinder.BindStatement(StatementSyntax node, DiagnosticBag diagnostics) in C:\a\42\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compilation\MemberSemanticModel.cs:line 911
at Microsoft.Dynamics.Nav.CodeAnalysis.MemberSemanticModel.GetBoundNodes(SyntaxNode node) in C:\a\42\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compilation\MemberSemanticModel.cs:line 390
at Microsoft.Dynamics.Nav.CodeAnalysis.MemberSemanticModel.GetLowerBoundNode(SyntaxNode node) in C:\a\42\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compilation\MemberSemanticModel.cs:line 330
at Microsoft.Dynamics.Nav.CodeAnalysis.MemberSemanticModel.GetBoundNodes(SyntaxNode node, SyntaxNode& bindableNode, BoundNode& lowestBoundNode, BoundNode& highestBoundNode, BoundNode& boundParent) in C:\a\42\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compilation\MemberSemanticModel.cs:line 199
at Microsoft.Dynamics.Nav.CodeAnalysis.MemberSemanticModel.GetSymbolInfoWorker(SyntaxNode node, CancellationToken cancellationToken) in C:\a\42\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compilation\MemberSemanticModel.cs:line 113
at Microsoft.Dynamics.Nav.CodeAnalysis.SyntaxTreeSemanticModel.GetSymbolInfoWorker(SyntaxNode node, CancellationToken cancellationToken) in C:\a\42\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compilation\SyntaxTreeSemanticModel.cs:line 110
at Microsoft.Dynamics.Nav.CodeAnalysis.SemanticModel.GetSymbolInfo(ExpressionSyntax expression, CancellationToken cancellationToken) in C:\a\42\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compilation\SemanticModel.cs:line 582
at Microsoft.Dynamics.Nav.CodeAnalysis.SemanticModel.GetSymbolInfoFromNode(SyntaxNode node, CancellationToken cancellationToken) in C:\a\42\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compilation\SemanticModel.cs:line 421
at Microsoft.Dynamics.Nav.CodeAnalysis.Workspaces.DocumentExtensions.GetSymbolFromNode(SemanticModel semanticModel, SyntaxNode node, CancellationToken cancellationToken) in C:\a\42\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis.Workspaces\Shared\Extensions\DocumentExtensions.cs:line 317
at Microsoft.Dynamics.Nav.CodeAnalysis.Workspaces.DocumentExtensions.<GetSymbolAtPositionAsync>d__9.MoveNext() in C:\a\42\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis.Workspaces\Shared\Extensions\DocumentExtensions.cs:line 186
--- 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.<GetSymbolAtPositionAsync>d__8.MoveNext() in C:\a\42\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis.Workspaces\Shared\Extensions\DocumentExtensions.cs:line 176
--- 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\42\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\LanguageServer\HoverRequestHandler.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.MessageProtocol.RequestHandlerBase`1.<HandleAsync>d__10.MoveNext() in C:\a\42\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\42\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\Endpoints\RequestRegistry.cs:line 59
Hi @OSHK, @ernestasju, it seems the issue is not reproducible anymore. Could you try it with the latest daily AL build, latest BC?
Hi, @AndreyKorepanov,
Yes, it is fixed. Checked using AL Language extensions from mcr.microsoft.com/businesscentral/sandbox
and bcinsider.azurecr.io/bcsandbox-master
.
Thanks.
Rewriting the filter form ItemJournalBatch.SetRange("Journal Template Name", "Journal Template Name"); ItemJournalBatch.SetRange(Name, "Journal Batch Name"); to ItemJournalBatch."Journal Template Name" := "Journal Template Name"; ItemJournalBatch.Name := "Journal Batch Name"; ItemJournalBatch.SetRecFilter();
Solved this issue for me. So try this workaround if you work on an older version of Business Central
I've created a new pageextension XXX EB Payment Journal based on the standard page 2000001 EB Payment Journal with the simple code on the OnAction trigger:
When I'm trying to publish my extension (press F5 in Visual Studio Code) debug console shows me the following strange error:
During the testing, I found 2 lines that cause this error. When these 2 lines are commented out the error disappears and package builds successfully:
Here you can find mentioned pageextension: Pag-Ext50017.XXXEBPaymentJournal.zip
Additional Info: AL Langauge: 2.1.76311 Visual Studio Code: 1.30.2 Target Database: D365BC CU 02 26413 (on premises)