in src/csharp/MonoDebugSession.cs [669:711]
public override void Variables(Response response, dynamic args)
{
int reference = getInt(args, "variablesReference", -1);
if (reference == -1) {
SendErrorResponse(response, 3009, "variables: property 'variablesReference' is missing", null, false, true);
return;
}
WaitForSuspend();
var variables = new List<Variable>();
ObjectValue[] children;
if (_variableHandles.TryGet(reference, out children)) {
if (children != null && children.Length > 0) {
bool more = false;
if (children.Length > MAX_CHILDREN) {
children = children.Take(MAX_CHILDREN).ToArray();
more = true;
}
if (children.Length < 20) {
// Wait for all values at once.
WaitHandle.WaitAll(children.Select(x => x.WaitHandle).ToArray());
foreach (var v in children) {
variables.Add(CreateVariable(v));
}
}
else {
foreach (var v in children) {
v.WaitHandle.WaitOne();
variables.Add(CreateVariable(v));
}
}
if (more) {
variables.Add(new Variable("...", null, null));
}
}
}
SendResponse(response, new VariablesResponseBody(variables));
}