AL icon indicating copy to clipboard operation
AL copied to clipboard

Compiling app using NextMajor version is failing with AL compiler error

Open amea20 opened this issue 2 years ago • 6 comments

Please include the following with each issue:

1. Describe the bug When trying to compile the app as a SaaS solution in the NextMajor container, I get a AL compiler error

Example artifact version $artifactUrl = Get-BCArtifactUrl -type Sandbox -country w1 -version 21.0.40263.0 -storageAccount bcinsider -select All -sasToken $sasToken

2. To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
Compile-AppInBcContainer -containerName bc `
                         -appProjectFolder $projectFolder `
                         -appOutputFolder $outputFolder `
                         -credential $credential

3. Expected behavior For the app to compile successfully with warnings

4. Actual behavior

Compiling...
.\alc.exe /project:"C:\Agents\nav-app\app" /packagecachepath:"C:\Agents\nav-app\app\.alpackages" /out:"C:\Agents\nav-app\app\Company_N
avApp_1.2.3.4.app" /assemblyprobingpaths:"C:\Program Files\Microsoft Dynamics NAV\210\Service","C:\Program Files (x86)\Open XML SDK\V2.5\lib","c:\Windows\Microsoft.NET\Assembly","C:\Te
st Assemblies\Mock Assemblies"
Microsoft (R) AL Compiler version 10.0.9.46544
Copyright (C) Microsoft Corporation. All rights reserved

Compilation started for project 'NavApp' containing '8314' files at '11:46:30.128'.


Compilation ended at '11:47:01.929'.

System.AggregateException: One or more errors occurred. (Object reference not set to an instance of an object.)
 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.SymbolWithPropertiesVisitor.IsPropertyDependencySatisifiedWithDefaultValue(PropertyTypeInfo propertyInfo, DependentProperty dependentProperty
) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Symbols\PropertyVisitor\SymbolWithPropertiesVisitor.cs:line 450
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.SymbolWithPropertiesVisitor.IsPropertyDependencySatisfied(Symbol symbolWithDependentProperties, DependentProperty dependentProperty) in D:\a\
1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Symbols\PropertyVisitor\SymbolWithPropertiesVisitor.cs:line 355
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.SymbolWithPropertiesVisitor.CheckDependentProperties(Symbol symbolWithProperties, DiagnosticBag diagnostics) in D:\a\1\s\source\Prod\Microsof
t.Dynamics.Nav.CodeAnalysis\Symbols\PropertyVisitor\SymbolWithPropertiesVisitor.cs:line 158
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.SymbolWithPropertiesVisitor.DefaultVisit(Symbol symbol, DiagnosticBag diagnostics) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysi
s\Symbols\PropertyVisitor\SymbolWithPropertiesVisitor.cs:line 57
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.SymbolWithPropertiesVisitor.VisitAction(ActionSymbol symbol, DiagnosticBag diagnostics) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAn
alysis\Symbols\PropertyVisitor\SymbolWithPropertiesVisitor.cs:line 500
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.ActionSymbol.Accept[TArgument,TResult](SymbolVisitor`2 visitor, TArgument a) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Gene
rated\Symbols.Generated.cs:line 116
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.SymbolWithPropertiesVisitor.VisitMembersOfSymbol(Symbol symbol, DiagnosticBag diagnostics) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.Cod
eAnalysis\Symbols\PropertyVisitor\SymbolWithPropertiesVisitor.cs:line 150
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.SymbolWithPropertiesVisitor.DefaultVisit(Symbol symbol, DiagnosticBag diagnostics) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysi
s\Symbols\PropertyVisitor\SymbolWithPropertiesVisitor.cs:line 63
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.SymbolWithPropertiesVisitor.VisitAction(ActionSymbol symbol, DiagnosticBag diagnostics) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAn
alysis\Symbols\PropertyVisitor\SymbolWithPropertiesVisitor.cs:line 500
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.ActionSymbol.Accept[TArgument,TResult](SymbolVisitor`2 visitor, TArgument a) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Gene
rated\Symbols.Generated.cs:line 116
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.SymbolWithPropertiesVisitor.VisitMembersOfSymbol(Symbol symbol, DiagnosticBag diagnostics) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.Cod
eAnalysis\Symbols\PropertyVisitor\SymbolWithPropertiesVisitor.cs:line 150
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.SymbolWithPropertiesVisitor.DefaultVisit(Symbol symbol, DiagnosticBag diagnostics) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysi
s\Symbols\PropertyVisitor\SymbolWithPropertiesVisitor.cs:line 63
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.SymbolVisitor`2.VisitContainer(ContainerSymbol node, TArgument argument) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Generate
d\SymbolVisitorWithArgumentAndResult.Generated.cs:line 326
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.SymbolVisitor`2.VisitType(TypeSymbol node, TArgument argument) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Generated\SymbolVi
sitorWithArgumentAndResult.Generated.cs:line 331
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.SymbolVisitor`2.VisitObjectType(ObjectTypeSymbol node, TArgument argument) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Genera
ted\SymbolVisitorWithArgumentAndResult.Generated.cs:line 336
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.SymbolVisitor`2.VisitRequestPageType(RequestPageTypeSymbol node, TArgument argument) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnaly
sis\Generated\SymbolVisitorWithArgumentAndResult.Generated.cs:line 281
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.RequestPageTypeSymbol.Accept[TArgument,TResult](SymbolVisitor`2 visitor, TArgument a) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnal
ysis\Generated\Symbols.Generated.cs:line 1199
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.SymbolWithPropertiesVisitor.VisitMembersOfSymbol(Symbol symbol, DiagnosticBag diagnostics) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.Cod
eAnalysis\Symbols\PropertyVisitor\SymbolWithPropertiesVisitor.cs:line 150
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.SymbolWithPropertiesVisitor.DefaultVisit(Symbol symbol, DiagnosticBag diagnostics) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysi
s\Symbols\PropertyVisitor\SymbolWithPropertiesVisitor.cs:line 63
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.SymbolVisitor`2.VisitContainer(ContainerSymbol node, TArgument argument) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Generate
d\SymbolVisitorWithArgumentAndResult.Generated.cs:line 326
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.SymbolVisitor`2.VisitType(TypeSymbol node, TArgument argument) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Generated\SymbolVi
sitorWithArgumentAndResult.Generated.cs:line 331
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.SymbolVisitor`2.VisitObjectType(ObjectTypeSymbol node, TArgument argument) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Genera
ted\SymbolVisitorWithArgumentAndResult.Generated.cs:line 336
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.SymbolVisitor`2.VisitApplicationObjectType(ApplicationObjectTypeSymbol node, TArgument argument) in D:\a\1\s\source\Prod\Microsoft.Dynamics.N
av.CodeAnalysis\Generated\SymbolVisitorWithArgumentAndResult.Generated.cs:line 341
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.SymbolVisitor`2.VisitReportType(ReportTypeSymbol node, TArgument argument) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Genera
ted\SymbolVisitorWithArgumentAndResult.Generated.cs:line 271
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.ReportTypeSymbol.Accept[TArgument,TResult](SymbolVisitor`2 visitor, TArgument a) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\
Generated\Symbols.Generated.cs:line 1161
   at Microsoft.Dynamics.Nav.CodeAnalysis.MethodCompiler.CompileProperties(ContainerSymbol containingType) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compiler\MethodCompiler.
cs:line 267
   at Microsoft.Dynamics.Nav.CodeAnalysis.MethodCompiler.CompileObject(ObjectTypeSymbol containingType) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compiler\MethodCompiler.cs:
line 171
   at Microsoft.Dynamics.Nav.CodeAnalysis.MethodCompiler.VisitObjectType(ObjectTypeSymbol symbol) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compiler\MethodCompiler.cs:line 1
61
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.SymbolVisitor.VisitReportType(ReportTypeSymbol node) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Generated\SymbolVisitor.Gene
rated.cs:line 271
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.ReportTypeSymbol.Accept(SymbolVisitor visitor) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Generated\Symbols.Generated.cs:lin
e 1151
   at Microsoft.Dynamics.Nav.CodeAnalysis.MethodCompiler.<>c__DisplayClass11_0.<CompileModule>b__0(Symbol memberSymbol) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compiler\Me
thodCompiler.cs:line 129
   --- End of inner exception stack trace ---
   at Microsoft.Dynamics.Nav.CodeAnalysis.MethodCompiler.CompileModule(ModuleSymbol moduleSymbol) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compiler\MethodCompiler.cs:line 1
40
   at Microsoft.Dynamics.Nav.CodeAnalysis.MethodCompiler.CompileMethodBodies(Compilation compilation, ModuleBuilder moduleBeingBuiltOpt, Boolean hasDeclarationErrors, DiagnosticBag diagnostic
s, Predicate`1 filterOpt, Predicate`1 radCompilationFilter, CancellationToken cancellationToken) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compiler\MethodCompiler.cs:line 10
3
   at Microsoft.Dynamics.Nav.CodeAnalysis.Compilation.CompileImpl(ModuleBuilder moduleBuilder, Boolean emittingPdb, DiagnosticBag diagnostics, Predicate`1 filterOpt, Predicate`1 radCompilatio
nFilter, CancellationToken cancellationToken) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compilation\Compilation.cs:line 1031
   at Microsoft.Dynamics.Nav.CodeAnalysis.Compilation.Compile(ModuleBuilder moduleBuilder, Boolean emittingPdb, DiagnosticBag diagnostics, Predicate`1 filterOpt, Predicate`1 radCompilationFil
ter, CancellationToken cancellationToken) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compilation\Compilation.cs:line 1003
   at Microsoft.Dynamics.Nav.CodeAnalysis.CommandLine.CommonCompiler.PackageTheModule(Compilation compilation, CompilerTextWriter consoleOutput, CancellationToken cancellationToken, ErrorLogg
er errorLogger, AnalyzerDriver analyzerDriver, Predicate`1 filterOpt, Predicate`1 radCompilationFilter) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\CommandLine\CommonCompiler.
cs:line 721
   at Microsoft.Dynamics.Nav.CodeAnalysis.CommandLine.CommonCompiler.RunCoreImpl(CompilerTextWriter consoleOutput, ErrorLogger errorLogger, Compilation compilation, AnalyzerDriver analyzerDri
ver, IEnumerable`1 analyzerExceptionDiagnostics, IEnumerable`1 additionalTextFiles, CancellationToken cancellationToken) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\CommandLin
e\CommonCompiler.cs:line 548
   at Microsoft.Dynamics.Nav.CodeAnalysis.CommandLine.CommonCompiler.RunCore(CompilerTextWriter consoleOutput, ErrorLogger errorLogger, CancellationToken cancellationToken) in D:\a\1\s\source
\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\CommandLine\CommonCompiler.cs:line 479
   at Microsoft.Dynamics.Nav.CodeAnalysis.CommandLine.CommonCompiler.Run(CompilerTextWriter consoleOutput, CancellationToken cancellationToken) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.
CodeAnalysis\CommandLine\CommonCompiler.cs:line 333
   at Microsoft.Dynamics.Nav.CodeAnalysis.CommandLine.Alc.<>c__DisplayClass1_0.<Run>b__0(CompilerTextWriter textWriterOut, CompilerTextWriter _) in D:\a\1\s\source\Prod\alc\Alc.cs:line 37
   at Microsoft.Dynamics.Nav.CodeAnalysis.CommandLine.ConsoleUtil.RunWithOutput[T](Boolean useUtf8Encoding, Func`3 func) in D:\a\1\s\source\Prod\alc\ConsoleUtil.cs:line 25
   at Microsoft.Dynamics.Nav.CodeAnalysis.CommandLine.Alc.Run(String clientDirectory, String baseDirectory, String[] args, IAnalyzerAssemblyLoader analyzerLoader) in D:\a\1\s\source\Prod\alc\
Alc.cs:line 37
App generation failed with exit code -1
Compile-AppInBcContainer Telemetry Correlation Id: 6d2e7783-6ab5-4991-8095-4b7d2abcd029
App generation failed with exit code -1
At C:\Program Files\WindowsPowerShell\Modules\bccontainerhelper\3.0.10\AppHandling\Compile-AppInNavContainer.ps1:651 char:72
+ ... | Where-Object { $_ -like "App generation failed*" } | % { throw $_ }
+                                                                ~~~~~~~~
    + CategoryInfo          : OperationStopped: (App generation failed with exit code -1:String) [], RuntimeException
    + FullyQualifiedErrorId : App generation failed with exit code -1
...

5. Versions:

  • AL Language: v10.0.6.43374
  • Visual Studio Code: 1.68.1
  • Business Central: 21.0.43085.0
  • List of Visual Studio Code extensions that you have installed: ** AL Language ** AL Extension Pack

Final Checklist

Please remember to do the following:

  • [x] Search the issue repository to ensure you are reporting a new issue

  • [x] Reproduce the issue after disabling all extensions except the AL Language extension

  • [x] Simplify your code around the issue to better isolate the problem Difficult to simplify the code since there are a lot of references in the AL objects.

amea20 avatar Aug 02 '22 06:08 amea20

Hello,

It has been 4 weeks and the problem has not been resolved yet. Can you please confirm the fix has been pushed and not still in development phase?

amea20 avatar Aug 02 '22 06:08 amea20

Hello,

It has been 4 weeks and the problem has not been resolved yet. Can you please confirm the fix has been pushed and not still in development phase?

Is there another issue for this? This particular issue was only opened 2 hours ago.

thloke avatar Aug 02 '22 08:08 thloke

Can you also provide sample AL code that reproduces this issue? Looking at the callstack, it looks like some report request page property is triggering this.

thloke avatar Aug 02 '22 08:08 thloke

Hello,

Ticket https://github.com/microsoft/AL/issues/7103 has been closed mentioning the fix has been put in place, but still isn't working.

amea20 avatar Aug 02 '22 09:08 amea20

Hello,

Ticket #7103 has been closed mentioning the fix has been put in place, but still isn't working.

It could be that the internal fix that we had wasn't exactly the same issue as the one you're running into. Can you provide sample AL code that reproduces this?

thloke avatar Aug 03 '22 02:08 thloke

Hello,

It's a private app being developed, and is as large as the baseapp.

Please let me know your email address so I may send it over using a Storage account SAS blob link

amea20 avatar Aug 09 '22 12:08 amea20

Hello Thaddeus,

Please provide an update on this matter, as we need to make sure there are no issues when submitting our app to AppSource for the release in October.

amea20 avatar Aug 16 '22 11:08 amea20

Hi Thaddeus,

After some further investigation with the Reports, I can see 1 Report AL file being the cause, but can't find out what is causing it. Do you have a helpful link showing what the new AL compiler version is doing with the report files?

amea20 avatar Aug 19 '22 14:08 amea20

Hello Thaddeus,

I have resolved the issue. It seems that a 3rd party who has helped us with converting the C/AL to AL code has somehow added the following properties into the action block within a Report AL file:

  • Promoted
  • PromotedIsBig

This seemed to be ignored when compiling AL code using version 9 and earlier, but for some reason ALC v10 is now erroring on that, but without specific validation on why that is. I hope that is something you can update in the code to ensure it provides further clarity on the error.

This ticket can now be closed. Thank you

amea20 avatar Aug 19 '22 16:08 amea20

Hi @amea20, thank you for reporting this issue. It seems to be a different scenrio than the one reproduced internally. With your additional comment, we have been able to reproduce the issue with this snippet:

report 50100 MyReport
{
    UsageCategory = ReportsAndAnalysis;
    ApplicationArea = All;

    requestpage
    {
        actions
        {
            area(processing)
            {
                action(ActionName)
                {
                    ApplicationArea = All;
                    PromotedIsBig = true;
                    Promoted = true;
                }
            }
        }
    }
}

qutreson avatar Sep 06 '22 11:09 qutreson

The fix for this issue has been checked in to the master branch. It will be available in the bcinsider.azurecr.io/bcsandbox-master Docker image starting from platform build number 22.0.46079.0 and VS Code Extension Version 11.0.676832.

If you don’t have access to these images you need to become part of the Ready2Go program: aka.ms/readytogo

For more details on code branches and docker images please read: https://blogs.msdn.microsoft.com/nav/2018/05/03/al-developer-previews-multiple-releases-and-github/ https://freddysblog.com/2020/06/25/working-with-artifacts/

JesperSchulz avatar Sep 07 '22 14:09 JesperSchulz