5040

Who Called Me?

call-stack
diagnostics
text-parsing

Who Called Me?

Support keeps asking the same question about your app's diagnostic log: which code path wrote this entry? A raw stack-trace blob pasted into a text field is impossible to filter, so your logging framework needs the answer as structured data — one record per frame, with the object, the procedure and the line. Business Central happily prints a call stack when something crashes; producing one while everything is running fine, and turning its text into records, is the exercise.

What you get

The starter ships two objects to keep exactly as given — include both in your submission, the grading tests reference them by name.

  • Table "Call Stack Frame" — a TableType = Temporary buffer (it never touches the database) with the fields "Entry No." (Integer, primary key), "Object Type" (Text[30]), "Object ID" (Integer), "Object Name" (Text[150]), "Procedure Name" (Text[150]) and "Line No." (Integer).
  • Codeunit "Stack Probe" — the known call chain the tests walk through: Outer calls Middle, Middle calls Inner, and Inner calls your Capture. A fourth procedure, CaptureFromSite, reaches Inner from one of two different call sites inside the same procedure, chosen by its Site parameter — the tests use it to check your line numbers.

Requirements

Implement the codeunit named "Call Stack Inspector" with one public procedure:

procedure Capture(var Frame: Record "Call Stack Frame")

Rules:

  1. Capture fills Frame with one record per frame of the current call stack, innermost first: "Entry No." 1 is Capture's direct caller, 2 is that procedure's caller, and so on all the way down — deeper frames below your objects (in the platform's test runner) are stored too, in order, with no gaps in the numbering.
The rest of the statement and 3 hints Unlock with Pro
ALBusiness Central 28.5
Pro
Pro problem

Solve it with Pro

You’re reading the opening of the statement. Pro unlocks the whole problem:

  • The full statement
  • Starter code in the browser editor
  • 9 grading tests, run on Business Central 28.5
  • 3 hints
  • The reference solution

Pro also opens all 92 Pro problems and lifts the daily limits on compile checks and submissions.

$10 / month
or $100 / year
Upgrade
This problem is part of Pro
Pro unlocks the full statement, tests, hints and solution. The code editor works on a computer.
Upgrade