IsComponentTreeValid question

Hi,

I'm doing some customization through an add-in.

If I open a sub-assembly, and I close it immediatly, the corresponding AssemblyDoc.IsComponentTreeValid returns false and I cannot use methods such GetComponents(). What I need to do in order to make the component tree valid again?

Thanks in advance

SolidworksApi macros