Skip to content

Guard signature swap against uninitialized temp records - #93

Closed
PropmanProphecy with Copilot wants to merge 2 commits into
mainfrom
copilot/find-reason-for-modify-failure
Closed

Guard signature swap against uninitialized temp records#93
PropmanProphecy with Copilot wants to merge 2 commits into
mainfrom
copilot/find-reason-for-modify-failure

Conversation

Copilot AI commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

LastSignatureTMP.Modify() could run before LastSignatureTMP referenced an inserted temporary PVS Job Signatures row. This happens because the build order is cover-first, so the first processed item is not guaranteed to be the residual sheet ("Entry No." = 1).

  • Root cause

    • The residual-sheet swap logic assumed LastSignatureTMP had already been initialized.
    • In both custom Build_Entries implementations, that assumption is false when a non-residual item is processed first.
  • Change

    • Added an explicit initialization guard before entering the swap path.
    • If no prior signature has been captured yet, the current temp record becomes LastSignatureTMP instead of attempting a Modify() on an uninitialized record.
  • Scope

    • BuildSignatures/PTEBuildSignatures.CodeUnit.al
    • Planning Board - ToolTip Performance/PTETooltip.CodeUnit.al
  • Behavioral effect

    • Preserves the existing residual-sheet reordering behavior once a baseline signature exists.
    • Avoids intermittent runtime failures caused by modifying a temp record with no current row.
if (JobItemTMP."Entry No." = 1) or (not LastSignatureInitialized) then begin
    LastSignatureTMP := out_RecTmp;
    LastSignatureInitialized := true;
end else begin
    out_RecTmp."Assembly Order" := LastSignatureTMP."Assembly Order";
    out_RecTmp.Indent := LastSignatureTMP.Indent;
    out_RecTmp.Modify();

    LastSignatureTMP."Assembly Order" := AssemblyOrder;
    LastSignatureTMP.Indent := Indentation;
    LastSignatureTMP.Modify();
end;
Original prompt

line 223 LastSignatureTMP.Modify(); can sometimes fail please se is you can find why you will need to look in the PrintVis app in the .alpackages folder

Created from VS Code.

Co-authored-by: PropmanProphecy <8543071+PropmanProphecy@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate failure of LastSignatureTMP.Modify in PrintVis app Guard signature swap against uninitialized temp records Sep 1, 2026
@PropmanProphecy
PropmanProphecy deleted the copilot/find-reason-for-modify-failure branch September 1, 2026 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants