in debugger/debugger-worker/src/Evaluation/Dots/DotsAdditionalValuesProvider.cs [89:154]
private IValueReference<TValue>? TryGetValueFromParentFrame(IStackFrame frame)
{
var containingReifiedType = frame.GetContainingReifiedType();
if (containingReifiedType == null || !containingReifiedType.MetadataType
.ImplementedInterfaces
.Any(t => ourSupportedEntityProcessingTypes.Contains(t.FullName)))
return null;
var callerFrame = frame.CallerFrame;
if (callerFrame == null)
return null;
var localVariables2 = callerFrame.GetLocalVariables2(mySession.EvaluationOptions)
.Concat(callerFrame.GetArguments2(mySession.EvaluationOptions));
IValue<TValue>? chunkValue = null;
IValue<TValue>? entityIndexInChunkValue = null;
foreach (var value in localVariables2)
{
if (value.SimpleName.Equals("chunk"))
chunkValue = value as IValue<TValue>;
else if (value.SimpleName.Equals("entityIndexInChunk") || value.SimpleName.Equals("entityIndex"))
entityIndexInChunkValue = value as IValue<TValue>;
if (chunkValue != null && entityIndexInChunkValue != null)
break;
}
if (chunkValue == null || entityIndexInChunkValue == null)
return null;
var entityIndexInChunk = entityIndexInChunkValue.ValueReference.AsPrimitive(mySession.EvaluationOptions)
.GetPrimitiveSafe<int>();
if (entityIndexInChunk == null)
return null;
var valueEntities = chunkValue.GetChildren(mySession.EvaluationOptions);
if (valueEntities == null)
return null;
IValue<TValue>? entitiesArray = null;
foreach (var valueEntity in valueEntities)
{
if (!valueEntity.SimpleName.Equals("Entities")) continue;
entitiesArray = valueEntity as IValue<TValue>;
break;
}
if (entitiesArray == null)
return null;
var arrayValueRole = entitiesArray.ValueReference.AsArray(mySession.EvaluationOptions);
var element = arrayValueRole.GetElement(entityIndexInChunk.Value);
if (element == null)
return null;
return new SimpleValueReference<TValue>(element, arrayValueRole.ElementType, "Current Entity",
ValueOriginKind.Property,
ValueFlags.None | ValueFlags.IsDefaultTypePresentation | ValueFlags.IsReadOnly, frame,
myValueServices.RoleFactory);
}