What is the correct way of getting a reference from AMyInfo* TArray?

I come from a C# background and am making the splash into C++ so my knowledge is quite limited at this stage.
I have been trying to implement a simple TArray by following the dynamic arrays tutorial on the wiki but seem to be encountering a rather silly issue.

In my header file I have a property :

UPROPERTY(EditAnywhere, Category = "General")
TArray<AMyInfo*> MyInfos;

Then, in a function inside my .cpp file I loop all the actors of my type via an iterator as add each of them to the MyInfos TArray.

TActorIterator<AMyInfo>ActorItr(GetWorld());  
while (ActorItr)  
	{
		MyInfos.Add(*ActorItr);
		++ActorItr;
	}

Up to this point I never encounter any errors or problems, so I assume I have not done anything too sinister and all is going to plan.

In another function inside my .cpp file I then want to get a reference to the pointer by doing the following:

 // for testing but this will change.
    if (MyInfos.IsValidIndex(0)) 
    {
          TAutoWeakObjectPtr<AMyInfo> info = TAutoWeakObjectPtr<AMyInfo>(MyInfos[0]);  
         // No matter what I try this value is always null.
    
    }

The code runs without error, however no matter what I try the value of info is always null. I have tested grabbing the object when I loop the actors and the object is definitely there.

My mind keeps pulling me back to my C# experience and I cannot help but wonder whether I am supposed to initialise the TArray property somewhere?

Any suggestions would be greatly appreciated.

#Comparison Test

You are sure you have lots of MyInfos in the world?

If you do a .Num() check on the array after running the iterator how many are you finding?

What happens if you just do this?

/ for testing but this will change.
if (MyInfos.IsValidIndex(0)) 
{
          AMyInfo* info = MyInfos[0];
          if(info)
          {
             //UE_LOG YAY ITS VALID
              }
   }

Thanks Rama. To confirm, I have exactly 1 instance of MyInfo in the world for testing purposes. The ActorItr while loop works and I can quite easily grab and use an instance of MyInfo within that loop, so as far as I know I definitely have an actor to use.

However I ran your test code the same problem occurred, although the call to MyInfos.IsValidIndex(0) returned true, the info variable was still NULL so it just skipped over the logging part.

So next I did a .Num() check as you suggested and to my surprise it came up with 2 items in the array. The item at index 0 was NULL, and the item at index 1 was the MyInfo object I was chasing. So yes, now I can access my object!

So I guess the only thing I need to figure out now is why MyInfos has two items in it. I just confirmed that the ActorItr while loop only executes once for the 1 MyInfo as expected so I am only making a single call to .Add().

Does TArray initialise with index 0 already allocated?

Any ideas?