Sequence of objects in locals

(JohnMoshakis) #1

Should it be possible to display sequences returned from methods in the debugger ?

For example with this code

namespace ListConsoleApplication;



Employee = public class
property Id:Integer;

Program = class
class method Main(args: array of String): Int32;
var objs := ProduceList;


class method ProduceList:sequence of Employee;
  var items := new List<Employee>;
  items.Add(new Employee(Id:=1));
  items.Add(new Employee(Id:=2));
  items.Add(new Employee(Id:=3));
  exit items;


If I set a breakpoint on the line after the ProduceList call, it doesnt show the rows assigned in locals.

If I change the method to List then it does.


(marc hoffman) #2

well, a sequence (a) could be infinitely long and (b) might. it be safe to re-execute without side effects (think database query), so the debugged cant just show it. calling ToList in the sequence should evaluate ok…

(JohnMoshakis) #3

Yes but could I have the option to expand it like in visual studio ?

(marc hoffman) #4

What would happen if you expand an infinite sequence?

(JohnMoshakis) #5

I think my machine would have hung before i even got the chance to expand. It should be up to the person debugging.

I was in the middle of debugging some database calls and I just wanted to see what was returned. To do that I have to stop the debugging session change the code and repeat.

(marc hoffman) #6

Ok, but what’s wring with just doing a .ToList?

(JohnMoshakis) #7

It interrupts the flow of my debugging session.

(marc hoffman) #8

FWIW, I didn’t mean to change the code, I meant to eval .ToList in a watch…

But anyways, I’ll log an issue and let you and Carlo fight it out :wink:

(RemObjects) #9

Thanks, logged as bugs://81876

(JohnMoshakis) #10

Oh. How would I do that. I know I can add watch from the selection but how do I add my own code ?

(marc hoffman) #11

just do “add watch” and add a custom expression…

(JohnMoshakis) #12

It just comes up with a popup that asks for the name48%20PM

(marc hoffman) #13


(JohnMoshakis) #14

I hit add watch and it doesnt seem to do anything

(marc hoffman) #15

Hmm, for me it adds a Watch to the Watches pane… :woman_shrugging:t3:

(JohnMoshakis) #16

Is name the name of the expression or the expression itself ? It does appear to do anything, I already had a watch on the sequence

(marc hoffman) #17

well. add ToList, obviously. So of your sequence (lets say a local var) is called mySequence, you’d add a watch for “mySequence.ToList()”?

(JohnMoshakis) #18

Could you rename “name” to something like “expression” ? (134.6 KB)

with the attached I get

(marc hoffman) #19

not sure i follow…?

(JohnMoshakis) #20
  1. The employees.ToList doesnt appear to work, see diagram
  2. In the UI could you rename “name” to “expression”