private bool TryInvokeGetChildren()

in debugger/debugger-worker/src/Values/Renderer/ChildrenRenderers/NodeObjectChildrenRenderer.cs [71:109]


        private bool TryInvokeGetChildren(IObjectValueRole<TValue> role,
            IValueFetchOptions options,
            out IObjectValueRole<TValue> returnedPropertyRole)
        {
            returnedPropertyRole = null;

            var method = MetadataTypeLiteEx.LookupInstanceMethodSafe(role.ReifiedType.MetadataType,
                MethodSelectors.NodeObject_GetChildren);
            if (method == null)
            {
                myLogger.Warn("Cannot find GetChildren method on NodeObject");
                return false;
            }

            if (method.Parameters.Any())
            {
                var frame = role.ValueReference.OriginatingFrame;
                var param = ValueServices.ValueFactory.CreatePrimitive(frame, options, method.Parameters.First().DefaultValue);
                returnedPropertyRole = new SimpleValueReference<TValue>(
                        role.CallInstanceMethod(options, method, param),
                        role.ValueReference.OriginatingFrame, ValueServices.RoleFactory)
                    .AsObjectSafe(options);
            }
            else
            {
                returnedPropertyRole = new SimpleValueReference<TValue>(
                        role.CallInstanceMethod(options, method),
                        role.ValueReference.OriginatingFrame, ValueServices.RoleFactory)
                    .AsObjectSafe(options);    
            }
            
            if (returnedPropertyRole == null)
            {
                myLogger.Warn("Unable to invoke GetChildren");
                return false;
            }

            return true;
        }