It does seem to be an issue with Revit, or maybe the family itself.
I had the same problem with 3 out of 3 light fixture families I frequently use. Here is a short macro that demonstrates the issue:
using Autodesk.Revit.DB.Lighting;
public void GetLightTypes()
{
UIDocument uidoc = this.ActiveUIDocument;
Document famDoc = this.ActiveUIDocument.Document;
// LightFamily API should work only in light fixture family document.
if (famDoc.OwnerFamily.FamilyCategory.Id.IntegerValue != (int)BuiltInCategory.OST_LightingFixtures)
{
TaskDialog.Show ("Error", "Not a Light Fixture Family");
}
else
{
int n = 0;
LightFamily lightFamily = LightFamily.GetLightFamily(famDoc);
n = lightFamily.GetNumberOfLightTypes();
TaskDialog.Show("Revit", n.ToString());
for (int index = 0; index < lightFamily.GetNumberOfLightTypes(); index++)
{
TaskDialog.Show("Index and Name", index.ToString() + " " + lightFamily.GetLightTypeName(index).ToString ());
}
}
The families i used were all older, and have probably been upgraded from earlier versions of Revit. That may be the problem.
When I made a new family, and created new types, it worked fine.
Unfortunately, doing an audit on the older family didn't seem to help. Neither did renaming the missing family type, or even duplicating the type and deleting the original type (one of the other types just goes missing.)
As a side note, anytime you turn off the light source for the family (under the family category and parameters), Revit starts giving an error message saying the family is a "non-lighting" family, and fails to run the code.