How to get nested struct member values?

I want to “recursively” list all properties of a UObject instance, something like a UMaterial. When I enter a nested struct member, that is, a struct property of UMaterial, and I want to get its member value like uint8, the following code does not work

void PrintStruct(FStructProperty* prop, UObject* obj)
{
    for (TFieldIterator<UProperty> it{ prop->Struct }; it; ++it)
    {
        auto value = prop->GetPropertyValue(prop->ContainerPtrToValuePtr<void>(prop->Struct));
    }
}

It fails at

	FORCEINLINE void* ContainerUObjectPtrToValuePtrInternal(UObject* ContainerPtr, int32 ArrayIndex) const
	{
    ...
		check(GetOwner<UClass>()); // Fails here

The part of UMaterial I am talking about:

UCLASS(hidecategories=Object, MinimalAPI, BlueprintType)
class UMaterial : public UMaterialInterface
{
    ...
    	UPROPERTY()
	FColorMaterialInput BaseColor;
    ....
};

I am not sure whether it is possible at all. Because the struct member of the UMaterial class itself, for example FColorMaterialInput is not attributed with USTRUCT macro, therefore it should not contain metadata for reflection? I am not sure and I am new to this. Please help!