AL icon indicating copy to clipboard operation
AL copied to clipboard

Error (property order issue in Nav 2018)

Open jprada842 opened this issue 8 years ago • 7 comments

Microsoft (R) AL Compiler version 0.12.17720 Copyright (C) Microsoft Corporation. All rights reserved

[Error - 01:30:55] Please report this issue to https://github.com/microsoft/al/issues including information on how to reproduce it, if possible. Processing of message 'al/createPackage' failed with error: 'Token StartAttribute in state Element Content would result in an invalid XML document.' StackTrace: at System.Xml.XmlWellFormedWriter.ThrowInvalidStateTransition(Token token, State currentState) at System.Xml.XmlWellFormedWriter.AdvanceState(Token token) at System.Xml.XmlWellFormedWriter.WriteStartAttribute(String prefix, String localName, String namespaceName) at System.Xml.XmlWriter.WriteAttributeString(String localName, String value) at Microsoft.Dynamics.Nav.CodeAnalysis.Emit.ObjectMetadataEmitHelper.WritePropertyValueMetadata(XmlWriter xmlWriter, PropertySymbol property) in C:\Agent_work\41\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Emitter\ObjectMetadataEmitHelper.cs:line 101 at Microsoft.Dynamics.Nav.CodeAnalysis.Emit.ObjectMetadataEmitter.WritePropertyValueMetadata(XmlWriter xmlWriter, PropertySymbol property) in C:\Agent_work\41\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Emitter\ObjectMetadataEmitter.cs:line 54 at Microsoft.Dynamics.Nav.CodeAnalysis.Emit.ObjectMetadataEmitHelper.WriteAttributeProperties(XmlWriter xmlWriter, IEnumerable1 properties, Action2 writePropertyMetadata) in C:\Agent_work\41\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Emitter\ObjectMetadataEmitHelper.cs:line 69 at Microsoft.Dynamics.Nav.CodeAnalysis.Emit.ObjectMetadataEmitHelper.WriteProperties(XmlWriter xmlWriter, Symbol declaringSymbol, IEnumerable1 properties, Action2 writePropertyMetadata, Boolean shouldOutputDefaultProperties) in C:\Agent_work\41\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Emitter\ObjectMetadataEmitHelper.cs:line 38 at Microsoft.Dynamics.Nav.CodeAnalysis.Emit.PageMetadataEmitter.<>c__DisplayClass3_0.b__1() in C:\Agent_work\41\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Emitter\PageMetadataEmitter.cs:line 87 at Microsoft.Dynamics.Nav.CodeAnalysis.Emit.ObjectMetadataEmitHelper.WriteStartEndElement(XmlWriter xmlWriter, String elementName, Action action) in C:\Agent_work\41\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Emitter\ObjectMetadataEmitHelper.cs:line 25 at Microsoft.Dynamics.Nav.CodeAnalysis.Emit.ObjectMetadataEmitHelper.WriteStartEndElement(XmlWriter xmlWriter, String elementName, Action action) in C:\Agent_work\41\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Emitter\ObjectMetadataEmitHelper.cs:line 25 at Microsoft.Dynamics.Nav.CodeAnalysis.Emit.PageMetadataEmitter.b__1_0(XmlWriter xmlWriter) in C:\Agent_work\41\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Emitter\PageMetadataEmitter.cs:line 33 at Microsoft.Dynamics.Nav.CodeAnalysis.Emit.ObjectMetadataEmitter1.EmitMetadata(Action1 content) in C:\Agent_work\41\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Emitter\GenericObjectMetadataEmitter.cs:line 37 at Microsoft.Dynamics.Nav.CodeAnalysis.MethodCompiler.CompileObject(ObjectTypeSymbol containingType) in C:\Agent_work\41\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compiler\MethodCompiler.cs:line 248 at Microsoft.Dynamics.Nav.CodeAnalysis.MethodCompiler.<>c__DisplayClass17_0.b__0() in C:\Agent_work\41\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compiler\MethodCompiler.cs:line 216 at Microsoft.Dynamics.Nav.CodeAnalysis.Utilities.UICultureUtilities.<>c__DisplayClass5_0.b__0() in C:\Agent_work\41\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Utilities\UICultureUtilities.cs:line 152 at System.Threading.Tasks.Task.Execute() --- 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.MethodCompiler.WaitForWorkers() in C:\Agent_work\41\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compiler\MethodCompiler.cs:line 161 at Microsoft.Dynamics.Nav.CodeAnalysis.MethodCompiler.CompileMethodBodies(Compilation compilation, ModuleBuilder moduleBeingBuiltOpt, Boolean hasDeclarationErrors, DiagnosticBag diagnostics, Predicate1 filterOpt, CancellationToken cancellationToken) in C:\Agent\_work\41\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compiler\MethodCompiler.cs:line 145 at Microsoft.Dynamics.Nav.CodeAnalysis.Compilation.CompileImpl(ModuleBuilder moduleBuilder, Boolean emittingPdb, DiagnosticBag diagnostics, Predicate1 filterOpt, CancellationToken cancellationToken) in C:\Agent_work\41\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compilation\Compilation.cs:line 810 at Microsoft.Dynamics.Nav.CodeAnalysis.Compilation.Compile(ModuleBuilder moduleBuilder, Boolean emittingPdb, DiagnosticBag diagnostics, Predicate`1 filterOpt, CancellationToken cancellationToken) in C:\Agent_work\41\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compilation\Compilation.cs:line 787 at Microsoft.Dynamics.Nav.CodeAnalysis.CommandLine.CommonCompiler.PackageTheModule(Compilation compilation, CompilerTextWriter consoleOutput, CancellationToken cancellationToken, ErrorLogger errorLogger, AnalyzerDriver analyzerDriver) in C:\Agent_work\41\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\CommandLine\CommonCompiler.cs:line 531 at Microsoft.Dynamics.Nav.CodeAnalysis.CommandLine.CommonCompiler.RunCore(CompilerTextWriter consoleOutput, ErrorLogger errorLogger, CancellationToken cancellationToken) in C:\Agent_work\41\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\CommandLine\CommonCompiler.cs:line 413 at Microsoft.Dynamics.Nav.CodeAnalysis.CommandLine.CommonCompiler.Run(CompilerTextWriter consoleOutput, CancellationToken cancellationToken) in C:\Agent_work\41\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\CommandLine\CommonCompiler.cs:line 312 at Microsoft.Dynamics.Nav.EditorServices.Protocol.LanguageServer.Extensions.CreatePackageRequestHandler.d__3.MoveNext() in C:\Agent_work\41\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\LanguageServer\Extensions\CreatePackageRequestHandler.cs:line 32 --- 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 C:\Agent_work\41\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\Endpoints\RequestRegistry.cs:line 59

jprada842 avatar May 25 '18 23:05 jprada842

Would it been possible to narrow down your code to a simple repro. Looks like emitting metadata for one of the page properties' fails.

kalberes avatar May 27 '18 12:05 kalberes

Hi all,

I have this error, or very similar. This can be reproduced with this kind of page

page 54000 "Test" { PageType = List; SourceTable = "Sales Line"; SourceTableView = where (Type = const (Item)); DelayedInsert = true; AutoSplitKey = true; layout { area(content) { group(GroupName) { field("No."; "No.") { ApplicationArea = All; } } } } }

As far as I know, if I put DelayedInsert and Autosplitkey properties just after the PageType, the problem disappears.

I've seen this kind of error with other properties (I don't remember which ones), where the order of the properties can solve or make problems when compiling.

Regards!

salmosa1 avatar Jun 05 '18 15:06 salmosa1

I have no repro for this the latest version. But this looks like a Nav 2018 related issue. We have had bugs related to property dependencies, but I am not sure they were back-ported to Nav 2018. Please raise a ticket with CSS to get this issue back-ported.

kalberes avatar Jun 07 '18 10:06 kalberes

Hi @All I have installed CU6 for 2018 and still facing the same issue that @jprada842 is facing. I have added a new Customize page of Type ListPart and made property of DelayedInsert as TRUE, code get compiled but the moment I do F5 to publish it throws an error :

"The request for path /dynamicsnav110cu6/dev/apps?SchemaUpdateMode=recreate failed with code 422. Reason: Token StartAttribute in state Element Content would result in an invalid XML document."

rishiaurrishabh avatar Jun 20 '18 03:06 rishiaurrishabh

Hi @thpeder / @jprada842 / @kalberes / @salmosa1 I think i somehow found a reason for this (still I will say it as a Bug):

when you mention DelayedInsert property after SourceTableView then you will get this message.

image

The moment you mention this property before Sourcetableview is works :) image

rishiaurrishabh avatar Jun 20 '18 04:06 rishiaurrishabh

I have had this problem with the order of the properties on pages many times (don't know if other objects also have a specific order for properties). It would be very helpful to have a list of the property order, that the compiler expects. Then we would not have to use a lot of time to try different orders or to search for a solution to the strange error.

Could someone provide a list of the expected order of properties?

MiePlougstrup avatar Jun 25 '18 09:06 MiePlougstrup

Hi @jprada842, @rishiaurrishabh, @MiePlougstrup, Apologies for a late reply.

There is no required order of properties for the compiler, therefore we can't really share anything like that. When you encounter such an issue, this is a bug and it must get fixed.

In the latest codebase, all known issues like this are already fixed, however it is possible that not all fixes have been backported to Nav 2018. Therefore, if you could open a support case for Nav 2018, the team responsible for that will take care of this request.

defr0std avatar Sep 03 '18 13:09 defr0std