← Back to Benchmark Results

openrouter/qwen/qwen3-coder-next

39.3%
Pass Rate
22/56
Tasks Passed
3
Runs
35.1%
pass@1
39.3%
pass@3
91.1%
Consistency
0.1
Temperature
-
Thinking
433,814
Tokens
$3.37
Cost
1st: 382nd: 21Failed: 3422/56 passed

Known Shortcomings (19)

Sorted by occurrence count (most frequent first)

# Concept AL Concept Count Affected Tasks
1 codeunit-generation-empty-output codeunit-definition 5 CG-AL-H010, CG-AL-H018, CG-AL-H022, CG-AL-M002, CG-AL-H205

Description: The model failed to generate any AL code at all. The generated code file is empty or missing, resulting in a compilation error AL0198 expecting an application object keyword. The task and tests are valid - the model simply did not produce the required codeunit 'CG Order Processor' (ID 70214) with IntegrationEvent publishers and the ProcessOrder/ValidateOrder procedures.

Correct Pattern:
codeunit 70214 "CG Order Processor"
{
    Access = Public;

    procedure ProcessOrder(OrderNo: Code[20]; Amount: Decimal; var ProcessedAmount: Decimal; var IsHandled: Boolean)
    begin
        OnBeforeProcessOrder(OrderNo, Amount, ProcessedAmount, IsHandled);
        if IsHandled then
            exit;
        ProcessedAmount := Amount * 1.1;
        OnAfterProcessOrder(OrderNo, Amount, ProcessedAmount);
    end;

    procedure ValidateOrder(OrderNo: Code[20]; Amount: Decimal): Boolean
    var
        IsValid: Boolean;
        Handled: Boolean;
    begin
        IsValid := false;
        Handled := false;
        OnBeforeValidateOrder(OrderNo, Amount, IsValid, Handled);
        if Handled then
            exit(IsValid);
        exit((Amount > 0) and (OrderNo <> ''));
    end;

    [IntegrationEvent(false, false)]
    local procedure OnBeforeProcessOrder(OrderNo: Code[20]; Amount: Decimal; var ProcessedAmount: Decimal; var IsHandled: Boolean)
    begin
    end;

    [IntegrationEvent(false, false)]
    local procedure OnAfterProcessOrder(OrderNo: Code[20]; OriginalAmount: Decimal; ProcessedAmount: Decimal)
    begin
    end;

    [IntegrationEvent(true, false)]
    local procedure OnBeforeValidateOrder(OrderNo: Code[20]; Amount: Decimal; var IsValid: Boolean; var Handled: Boolean)
    begin
    end;
}
Incorrect Pattern:

Error Codes: AL0198, AL0124

2 interface-definition-syntax interface-definition 3 CG-AL-E032, CG-AL-H015, CG-AL-M009

Description: The model failed to generate valid AL code for an interface definition. The compilation errors (AL0104 at line 12:25 expecting ';', AL0124 saying the property '"CG Token Provider"' cannot be used in this context) suggest the model likely generated something like a codeunit or used incorrect syntax for declaring an AL interface. AL interfaces use the 'interface' keyword without an object ID, e.g., 'interface "CG Token Provider"' rather than 'interface 50100 "CG Token Provider"'. The model also needed to generate a mock codeunit implementing the interface, which it apparently failed to do correctly.

Correct Pattern:
interface "CG Token Provider"
{
    Access = Public;

    procedure GetToken(Endpoint: Text; ForceRefresh: Boolean): Text;
    procedure ClearCache();
}

codeunit 50032 "CG-AL-E032 Mock Token Provider" implements "CG Token Provider"
{
    var
        ClearCacheCount: Integer;

    procedure GetToken(Endpoint: Text; ForceRefresh: Boolean): Text
    begin
        if ForceRefresh then
            exit('TOKEN:' + Endpoint + ':F')
        else
            exit('TOKEN:' + Endpoint + ':C');
    end;

    procedure ClearCache()
    begin
        ClearCacheCount += 1;
    end;

    procedure GetClearCacheCallCount(): Integer
    begin
        exit(ClearCacheCount);
    end;
}
Incorrect Pattern:
// Generated code not found - but errors suggest incorrect interface declaration syntax, likely including an object ID number

Error Codes: AL0104, AL0198

3 query-object-syntax query-definition 2 CG-AL-H011, CG-AL-H017

Description: The model failed to generate valid AL code for a query object. The compilation errors (AL0104 'Syntax error, } expected' and AL0198 'Expected one of the application object keywords') at line 5 indicate the model produced syntactically invalid AL code that doesn't conform to the query object structure. The generated code file was either empty, malformed, or used incorrect syntax for defining an AL query object with dataitems, columns, and filter elements. The task and tests are perfectly valid - the model simply lacks knowledge of how to properly construct an AL query object.

Correct Pattern:
query 70011 "CG Sales Summary"
{
    QueryType = Normal;
    OrderBy = ascending(Sell_to_Customer_No);

    elements
    {
        dataitem(SalesLine; "Sales Line")
        {
            column(Document_No; "Document No.") { }
            column(Sell_to_Customer_No; "Sell-to Customer No.") { }
            column(Line_Amount_Sum; "Line Amount") { Method = Sum; }
            column(Line_Count; "Line Amount") { Method = Count; }
            filter(Document_Type; "Document Type") { ColumnFilter = const(Order); }
        }
    }
}
Incorrect Pattern:
// Generated code not found (the produced file had syntax errors at line 5)

Error Codes: AL0104, AL0114

4 initvalue-vs-defaultvalue field-properties 1 CG-AL-E001

Description: The model used the property 'DefaultValue' on a Boolean field to set the default to true, but in AL for Business Central, the correct property name is 'InitValue', not 'DefaultValue'. The compiler error AL0124 indicates that 'DefaultValue' is not a valid property in this context. The model should have used 'InitValue = true;' on the Active field to ensure it defaults to true when Init() is called.

Correct Pattern:
field(3; Active; Boolean)
{
    Caption = 'Active';
    DataClassification = CustomerContent;
    InitValue = true;
}
Incorrect Pattern:
field(3; Active; Boolean)
{
    Caption = 'Active';
    DataClassification = CustomerContent;
    DefaultValue = true;
}

Error Codes: AL0124

5 text-trim-method-unavailable text-manipulation-methods 1 CG-AL-E005

Description: The model generated code that uses a 'Trim' method on a Text variable, which does not exist in AL. In AL, Text type does not have a built-in Trim() method. The model likely confused AL's Text type methods with C# string methods. To trim whitespace in AL, the model should use DelChr() function instead, e.g., DelChr(InputText, '<>', ' ') to remove leading and trailing spaces. The compilation error AL0118 'The name Trim does not exist in the current context' confirms this. The generated code was not captured but the error at line 45 indicates the model attempted to call Trim() likely in the CountWords procedure when handling extra spaces.

Correct Pattern:
// Use DelChr to trim whitespace in AL:
InputText := DelChr(InputText, '<>', ' ');
// Or for more complex trimming, use a loop-based approach
Incorrect Pattern:
// Approximate reconstruction based on error:
// SomeVariable := InputText.Trim();  // or Trim(InputText)

Error Codes: AL0118

6 table-extension-for-custom-fields table-extension 1 CG-AL-E006

Description: The task asks to create a page extension that adds fields (Preferred Contact Method, Customer Notes, VIP Customer) to the Customer Card. However, these fields don't exist on the base Customer table (Table 18). The model needed to create BOTH a table extension (to add the new fields to the Customer table) AND a page extension (to display them on the Customer Card). The model either failed to generate any code or generated only a page extension without the required table extension, resulting in compilation errors because the Customer record doesn't contain definitions for the new fields. The test file accesses these fields directly on the Customer record (e.g., Customer."Preferred Contact Method"), which requires a table extension to define them.

Correct Pattern:
tableextension 70000 "Customer Extension" extends Customer
{
    fields
    {
        field(70000; "Preferred Contact Method"; Option)
        {
            Caption = 'Preferred Contact Method';
            OptionMembers = Email,Phone,Mail,SMS;
            OptionCaption = 'Email,Phone,Mail,SMS';
        }
        field(70001; "Customer Notes"; Text[500])
        {
            Caption = 'Customer Notes';
        }
        field(70002; "VIP Customer"; Boolean)
        {
            Caption = 'VIP Customer';
        }
    }
}

pageextension 70000 "Customer Card Extension" extends "Customer Card"
{
    layout
    {
        addlast(General)
        {
            field("Preferred Contact Method"; Rec."Preferred Contact Method")
            {
                ApplicationArea = All;
                Caption = 'Preferred Contact Method';
            }
            field("Customer Notes"; Rec."Customer Notes")
            {
                ApplicationArea = All;
                Caption = 'Customer Notes';
            }
            field("VIP Customer"; Rec."VIP Customer")
            {
                ApplicationArea = All;
                Caption = 'VIP Customer';
            }
        }
    }
}
Incorrect Pattern:
// Generated code not found - model failed to produce valid output

Error Codes: AL0132

7 multiline-string-literals text-literal-syntax 1 CG-AL-E050

Description: The model attempted to use multiline string literals by placing actual line breaks inside single-quoted AL text literals (e.g., 'SELECT...\nFROM...'), which is not valid AL syntax. AL text literals must be terminated on the same line. The correct approach in modern AL (runtime 12.0+) is to use the @'' verbatim string literal syntax for multiline strings, or alternatively use string concatenation with explicit newline characters (e.g., using a variable set to char 13 + char 10). The AL0360 error 'Text literal was not properly terminated' confirms the model broke a string across multiple lines without using the proper verbatim string syntax.

Correct Pattern:
var
    CrLf: Text[2];
    Result: Text;
begin
    CrLf[1] := 13;
    CrLf[2] := 10;
    Result := 'SELECT CustomerNo, Name, Balance' + CrLf + 'FROM Customer' + CrLf + 'WHERE Active = true' + CrLf + 'ORDER BY Name';
    exit(Result);
end;
Incorrect Pattern:
exit('SELECT CustomerNo, Name, Balance
FROM Customer
WHERE Active = true
ORDER BY Name');

Error Codes: AL0360

8 list-of-text-no-clear-method list-type-methods 1 CG-AL-E051

Description: The model generated code that calls .Clear() on a 'List of [Text]' variable. In AL, the List type does not have a Clear method. To reset a list, you should declare a new list variable or use other approaches. The model incorrectly assumed that List of [Text] supports a .Clear() method, which caused AL0132 compilation errors. The task and tests are perfectly valid - the model simply used an API that doesn't exist on the AL List type.

Correct Pattern:
Instead of calling .Clear() on a List of [Text], either declare a fresh local List of [Text] variable or re-initialize it. For example, use 'Clear(MyList);' (the built-in Clear function) rather than 'MyList.Clear();' (a method call on the list).
Incorrect Pattern:
SomeListVariable.Clear();

Error Codes: AL0132

9 codeunit-generation-empty-output tryfunction-pattern 1 CG-AL-H008

Description: The model failed to generate any AL code at all. The compilation error 'Expected one of the application object keywords' at position 1:1 indicates the generated file was either empty or contained no valid AL object declaration. The task required creating a codeunit implementing the TryFunction pattern with safe execution wrappers, but the model produced no recognizable AL code. The task definition and test file are both valid and correct.

Correct Pattern:
codeunit 70212 "CG Safe Executor"
{
    Access = Public;

    [TryFunction]
    procedure TryDivide(Numerator: Decimal; Denominator: Decimal; var Result: Decimal)
    begin
        if Denominator = 0 then
            Error('Division by zero');
        Result := Numerator / Denominator;
    end;

    procedure SafeDivide(Numerator: Decimal; Denominator: Decimal; DefaultValue: Decimal): Decimal
    var
        Result: Decimal;
    begin
        if TryDivide(Numerator, Denominator, Result) then
            exit(Result)
        else
            exit(DefaultValue);
    end;

    [TryFunction]
    procedure TryParseInteger(InputText: Text; var ParsedValue: Integer)
    begin
        Evaluate(ParsedValue, InputText);
    end;

    procedure SafeParseInteger(InputText: Text; DefaultValue: Integer): Integer
    var
        ParsedValue: Integer;
    begin
        if TryParseInteger(InputText, ParsedValue) then
            exit(ParsedValue)
        else
            exit(DefaultValue);
    end;

    procedure ExecuteWithFallback(PrimaryValue: Decimal; FallbackValue: Decimal; Divisor: Decimal): Decimal
    var
        Result: Decimal;
    begin
        if TryDivide(PrimaryValue, Divisor, Result) then
            exit(Result);
        if TryDivide(FallbackValue, Divisor, Result) then
            exit(Result);
        exit(0);
    end;
}
Incorrect Pattern:

Error Codes: AL0198

10 empty-or-missing-code-generation basic-code-generation 1 CG-AL-H007

Description: The model failed to generate any valid AL code at all. The compilation error AL0198 'Expected one of the application object keywords' at position 1:1 indicates the generated file was either empty or contained no valid AL object declarations. The model needed to produce both an enum 'CG Validation Error' (ID 70211) and a codeunit 'CG Validation Engine' (ID 70210) using ErrorInfo, CustomDimensions, and modern error handling patterns, but produced nothing usable.

Correct Pattern:
enum 70211 "CG Validation Error"
{
    Extensible = false;
    value(0; None) { }
    value(1; EmptyField) { }
    value(2; InvalidFormat) { }
    value(3; OutOfRange) { }
    value(4; DuplicateValue) { }
}

codeunit 70210 "CG Validation Engine"
{
    Access = Public;

    procedure CreateValidationError(ErrorCode: Enum "CG Validation Error"; FieldName: Text; ErrorMessage: Text): ErrorInfo
    var
        ErrInfo: ErrorInfo;
        Dims: Dictionary of [Text, Text];
    begin
        ErrInfo.Message(ErrorMessage);
        Dims.Add('ErrorCode', Format(ErrorCode.AsInteger()));
        Dims.Add('FieldName', FieldName);
        ErrInfo.CustomDimensions(Dims);
        ErrInfo.Collectible(IsCollectingErrors());
        exit(ErrInfo);
    end;

    procedure GetErrorCode(ErrInfo: ErrorInfo): Enum "CG Validation Error"
    var
        CodeText: Text;
        CodeInt: Integer;
    begin
        CodeText := ErrInfo.CustomDimensions.Get('ErrorCode');
        Evaluate(CodeInt, CodeText);
        exit(Enum::"CG Validation Error".FromInteger(CodeInt));
    end;

    procedure ValidateNotEmpty(Value: Text; FieldName: Text)
    var
        ErrInfo: ErrorInfo;
    begin
        if Value = '' then begin
            ErrInfo := CreateValidationError("CG Validation Error"::EmptyField, FieldName, 'Field cannot be empty');
            Error(ErrInfo);
        end;
    end;

    procedure ValidateInRange(Value: Decimal; MinValue: Decimal; MaxValue: Decimal; FieldName: Text)
    var
        ErrInfo: ErrorInfo;
    begin
        if (Value < MinValue) or (Value > MaxValue) then begin
            ErrInfo := CreateValidationError("CG Validation Error"::OutOfRange, FieldName, StrSubstNo('Value must be between %1 and %2', MinValue, MaxValue));
            Error(ErrInfo);
        end;
    end;
}
Incorrect Pattern:
// Generated code not found

Error Codes: AL0198

11 al-object-structure-syntax table-and-codeunit-definition 1 CG-AL-H003

Description: The model generated AL code with syntax errors - the compilation errors (AL0104 'Syntax error, } expected' at line 50, AL0114 'integer literal expected' at line 50, and AL0198 'Expected one of the application object keywords' at line 93) indicate the model produced malformed AL code. The task required creating both a table (ID 70203 'CG Discount Result') and a codeunit (ID 70202 'CG Temp Table Processor') with proper structure, but the generated code had fundamental syntax issues, likely around the table field definitions or object boundaries. The 'Generated code not found' note and the compilation errors at specific lines suggest the model either produced incomplete code or used incorrect syntax for defining the table fields and/or the codeunit procedure with temporary table parameters.

Correct Pattern:
table 70203 "CG Discount Result"
{
    DataClassification = ToBeClassified;

    fields
    {
        field(1; "Line No."; Integer) { }
        field(2; "Item No."; Code[20]) { }
        field(3; "Original Price"; Decimal) { }
        field(4; "Discount Percent"; Decimal) { }
        field(5; "Final Price"; Decimal) { }
    }

    keys
    {
        key(PK; "Line No.") { Clustered = true; }
    }
}

codeunit 70202 "CG Temp Table Processor"
{
    Access = Public;

    procedure ProcessItemsWithDiscount(var TempResult: Record "CG Discount Result" temporary; MinDiscount: Decimal)
    var
        Item: Record Item;
        LineNo: Integer;
        Discount: Decimal;
    begin
        TempResult.Reset();
        TempResult.DeleteAll();
        LineNo := 0;

        Item.SetFilter("Unit Price", '>0');
        if Item.FindSet() then
            repeat
                if Item.Inventory >= 100 then
                    Discount := 15
                else if Item.Inventory >= 50 then
                    Discount := 10
                else if Item.Inventory >= 10 then
                    Discount := 5
                else
                    Discount := 0;

                if Discount >= MinDiscount then begin
                    LineNo += 1;
                    TempResult.Init();
                    TempResult."Line No." := LineNo;
                    TempResult."Item No." := Item."No.";
                    TempResult."Original Price" := Item."Unit Price";
                    TempResult."Discount Percent" := Discount;
                    TempResult."Final Price" := Round(Item."Unit Price" * (1 - Discount / 100), 0.01);
                    TempResult.Insert();
                end;
            until Item.Next() = 0;
    end;
}
Incorrect Pattern:
Generated code not available (marked as 'not found'), but compilation errors at line 50 and 93 indicate malformed object definitions

Error Codes: AL0104

12 reserved-keyword-as-parameter-name al-syntax-reserved-words 1 CG-AL-H014

Description: The model used 'Key' as a parameter name in the SafeGetText procedure, but 'key' is a reserved keyword in AL. The task definition specifies the parameter should be named 'Key', which conflicts with AL's reserved word. However, the model should have known to escape it or use an alternative name. The error AL0105 at line 50 indicates the compiler encountered 'key' where an identifier was expected. In AL, reserved keywords can be used as identifiers by enclosing them in double quotes, e.g., "Key". The model failed to apply this AL syntax rule.

Correct Pattern:
procedure SafeGetText(Obj: JsonObject; "Key": Text; DefaultValue: Text): Text — or use a non-reserved name like KeyName. In AL, reserved words used as identifiers must be enclosed in double quotes.
Incorrect Pattern:
procedure SafeGetText(Obj: JsonObject; Key: Text; DefaultValue: Text): Text

Error Codes: AL0105

13 dictionary-iteration-syntax dictionary-foreach-loop 1 CG-AL-H020

Description: The model attempted to use 'Key' as a foreach variable name or used incorrect syntax for iterating over a Dictionary in AL. In AL, you cannot use 'foreach Key in Dict.Keys do' or similar patterns directly. Instead, you must retrieve the keys into a List first using Dict.Keys() and then iterate over that list, or use the correct foreach syntax: 'foreach KeyVar in Dict.Keys do' where KeyVar is a properly declared variable. The errors at lines 60 and 113 indicate the model wrote something like 'Key in Dict' without properly declaring Key as a variable, or used a syntax pattern not valid in AL for dictionary iteration.

Correct Pattern:
Declare a variable (e.g., KeyVar: Text;) and use 'foreach KeyVar in Dict.Keys do begin ... end;' or retrieve keys first with 'Keys := Dict.Keys;' then iterate over the Keys list.
Incorrect Pattern:
Key in Dict (approximate - the model used 'Key' as an undeclared identifier or invalid syntax at lines 60 and 113 for dictionary iteration)

Error Codes: AL0519

14 page-object-structure page-definition 1 CG-AL-M004

Description: The model failed to generate valid AL code for a page object. The compilation errors (AL0104 'Syntax error, } expected' at line 14, and AL0198 expecting an application object keyword) indicate the generated code has fundamental structural/syntax issues - likely the model produced incomplete or malformed page definition syntax. The 'Generated code not found' note and the nature of the errors (expecting closing brace and object keywords) suggest the model either produced no meaningful output or produced severely malformed AL page code that doesn't follow the basic page object structure pattern (page ID Name { ... }).

Correct Pattern:
page 70101 "Sales Order Workspace"
{
    PageType = Card;
    SourceTable = "Sales Header";
    SourceTableView = where("Document Type" = const(Order));

    layout
    {
        area(Content)
        {
            group(General)
            {
                field("No."; Rec."No.") { ApplicationArea = All; }
                field("Sell-to Customer No."; Rec."Sell-to Customer No.") { ApplicationArea = All; }
                field("Sell-to Customer Name"; Rec."Sell-to Customer Name") { ApplicationArea = All; }
                field("Order Date"; Rec."Order Date") { ApplicationArea = All; }
                field("Posting Date"; Rec."Posting Date") { ApplicationArea = All; }
                field(Status; Rec.Status) { ApplicationArea = All; }
            }
            group(Financial)
            {
                field(Amount; Rec.Amount) { ApplicationArea = All; }
                field("Amount Including VAT"; Rec."Amount Including VAT") { ApplicationArea = All; }
            }
            part(Lines; "Sales Order Subform")
            {
                ApplicationArea = All;
                SubPageLink = "Document No." = field("No.");
            }
        }
    }

    actions
    {
        area(Processing)
        {
            action(CalculateTotals)
            {
                ApplicationArea = All;
                Caption = 'Calculate Totals';
                Promoted = true;
                Enabled = IsNotReleased;
                trigger OnAction()
                begin
                    Rec.CalcFields(Amount, "Amount Including VAT");
                    Message('Totals calculated: Amount = %1, Amount Incl. VAT = %2', Rec.Amount, Rec."Amount Including VAT");
                end;
            }
            action(ApplyDiscount)
            {
                ApplicationArea = All;
                Caption = 'Apply Discount';
                Promoted = true;
                Enabled = IsNotReleased;
                trigger OnAction()
                begin
                    if Confirm('Apply 10% discount?') then
                        Message('10% discount applied.');
                end;
            }
            action(ExportPDF)
            {
                ApplicationArea = All;
                Caption = 'Export to PDF';
                Promoted = true;
                trigger OnAction()
                begin
                    Message('PDF would be generated for order %1.', Rec."No.");
                end;
            }
            action(SendEmail)
            {
                ApplicationArea = All;
                Caption = 'Send Email';
                Promoted = true;
                trigger OnAction()
                begin
                    Message('Email would be sent for order %1.', Rec."No.");
                end;
            }
        }
    }

    var
        IsNotReleased: Boolean;

    trigger OnAfterGetRecord()
    begin
        IsNotReleased := Rec.Status <> Rec.Status::Released;
    end;
}
Incorrect Pattern:
// Generated code not found - the model produced malformed or incomplete AL page code that failed at line 14 with syntax errors

Error Codes: AL0104

15 json-object-get-pattern json-api-usage 1 CG-AL-M020

Description: The model incorrectly used JsonObject.Get() by passing typed variables (Text, Decimal, Boolean, Integer, JsonArray) directly as the second argument instead of using a JsonToken variable. In AL, JsonObject.Get(key, var JsonToken) returns a JsonToken, which must then be converted via AsValue().AsText(), AsValue().AsDecimal(), etc. The model also used non-existent methods like JsonToken.IsInteger(), JsonToken.AsInteger(), JsonToken.AsText(), and JsonObject.GetNames(). The correct pattern is to get a JsonToken first, then use .AsValue() to get a JsonValue, and then call the appropriate type conversion method on the JsonValue.

Correct Pattern:
var JToken: JsonToken; JValue: JsonValue; JArray: JsonArray; ... ProductJson.Get('name', JToken); JValue := JToken.AsValue(); NameText := JValue.AsText(); ... ProductJson.Get('price', JToken); JValue := JToken.AsValue(); PriceDecimal := JValue.AsDecimal(); ... ProductJson.Get('values', JToken); JArray := JToken.AsArray(); ... For iterating keys, use JsonObject.Keys() which returns a List of [Text]. For integer from JsonValue, use AsInteger(). For text representation, use Format() on the typed value.
Incorrect Pattern:
ProductJson.Get('name', NameText); ProductJson.Get('price', PriceDecimal); token.IsInteger(); token.AsInteger(); token.AsText(); ConfigJson.GetNames()

Error Codes: AL0133

16 json-token-key-variable-naming json-object-iteration 1 CG-AL-M021

Description: The model generated code that uses 'Key' as a variable name or token in a context where AL doesn't recognize it. The errors at lines 56, 85, and 113 all show 'Key' is not valid in this context, suggesting the model tried to use a pattern like iterating over JsonObject keys using a syntax that doesn't exist in AL (e.g., 'Key := ...' or 'foreach Key in ...'). In AL, to iterate over JsonObject keys, you must use JsonObject.Keys and proper enumeration patterns, or use JsonToken/JsonValue types correctly. Additionally, the error at line 153 about preprocessor directives suggests the model may have included a '#' character in a string or comment that AL interprets as a preprocessor directive not at the start of a line. The model lacks knowledge of proper AL JSON API iteration patterns and how to work with JsonObject.Keys() which returns a List of Text.

Correct Pattern:
Use proper AL JsonObject iteration: declare 'KeyName: Text' and 'KeyList: List of [Text]', call KeyList := JObj.Keys, then 'foreach KeyName in KeyList do begin ... end'. Avoid using 'Key' as a bare identifier or reserved-word-like token.
Incorrect Pattern:
Key (used as identifier in invalid context at lines 56, 85, 113)

Error Codes: AL0519

17 date-arithmetic-calcdate date-manipulation 1 CG-AL-M088

Description: The model attempted to use .AddMonths() and .AddYears() methods on the Date type, which do not exist in AL. In AL/Business Central, date arithmetic is performed using the CalcDate function with date formula strings (e.g., CalcDate('<1M>', BaseDate) to add one month). The model appears to have confused AL's date handling with C#/.NET date methods.

Correct Pattern:
CalcDate('<1M>', BaseDate) for adding 1 month, CalcDate('<3M>', BaseDate) for adding 3 months, CalcDate('<1Y>', BaseDate) for adding 1 year
Incorrect Pattern:
BaseDate.AddMonths(1) / BaseDate.AddMonths(3) / BaseDate.AddYears(1)

Error Codes: AL0132

18 markdown-in-al-output code-generation-format 1 CG-AL-M005

Description: The model failed to generate valid AL code entirely. The compilation errors (unexpected backtick characters, unterminated text literals, expected application object keywords) indicate the model output markdown-formatted text (with backtick code fences) or explanatory prose instead of raw AL code. The generated code file contains markdown formatting artifacts rather than a proper AL codeunit definition. The task and tests are valid - the model simply failed to produce any valid AL code for the 'External Payment Service' codeunit.

Correct Pattern:
codeunit 70002 "External Payment Service"
{
    procedure SendPaymentRequest(OrderId: Text; Amount: Decimal; Currency: Text; var ResponseJson: JsonObject): Boolean
    begin
        // HTTP client implementation
    end;

    procedure ValidatePaymentResponse(Response: JsonObject): Boolean
    begin
        // Validate required fields and status
    end;

    procedure GetPaymentStatus(TransactionId: Text): Text
    begin
        // Return payment status
    end;

    procedure HandlePaymentWebhook(WebhookData: JsonObject): Boolean
    begin
        // Process webhook events
    end;

    procedure LogPaymentTransaction(TransactionId: Text[50]; Amount: Decimal; Status: Text[20])
    begin
        // Log transaction
    end;
}
Incorrect Pattern:
// Generated code not found - file contains markdown with backticks and prose instead of AL code

Error Codes: AL0198

19 empty-or-markdown-output code-generation-basics 1 CG-AL-M007

Description: The model failed to generate valid AL code entirely. The compilation errors (unexpected characters like '|', '`', '—') indicate the model output markdown-formatted text (likely a markdown table or explanation) instead of actual AL code. The task required generating both a Report object (ID 70001) named 'Sales Performance Analysis' and a helper codeunit 'CG-AL-M007 Mock Calculator' with specific calculation methods. The model produced no valid AL code at all - the output appears to be markdown content with pipe characters (table formatting), backticks (code formatting), and em-dashes rather than AL application objects.

Correct Pattern:
report 70001 "Sales Performance Analysis"
{
    UsageCategory = ReportsAndAnalysis;
    ApplicationArea = All;
    DefaultRenderingLayout = RDLCLayout;
    dataset
    {
        dataitem(Customer; Customer)
        {
            ...
            dataitem(SalesHeader; "Sales Header")
            {
                ...
                dataitem(SalesLine; "Sales Line")
                {
                    ...
                }
            }
        }
    }
    requestpage { ... }
}

codeunit 70001 "CG-AL-M007 Mock Calculator"
{
    procedure Initialize() ...
    procedure AddSalesLine(...) ...
    procedure GetRunningTotalByCustomer(...): Decimal ...
    procedure GetRunningTotalByRegion(...): Decimal ...
    procedure CalculateAverageOrderValue(): Decimal ...
    procedure GetCustomerRank(...): Integer ...
    procedure GetTopProduct(): Code[20] ...
    procedure GetProductSalesQuantity(...): Decimal ...
    procedure CalculateYoYComparison(...): Decimal ...
    procedure CalculateOrderFrequency(...): Decimal ...
    procedure GetTotalSales(): Decimal ...
    procedure GetCustomerCount(): Integer ...
}
Incorrect Pattern:
Generated code not found - output contained markdown characters (|, `, —) instead of AL code

Error Codes: AL0198