1 Reply Latest reply on Mar 3, 2017 12:25 PM by Patrik MacHalec

    Component2.GetVisibility returns -1

    Jana Fischer

      Sometimes when I call

       

      IComponent2.GetVisibility(3, new string[] { "configName" })[0]

      ( it gets the visibility state of the component in configuration "configName")

       

      I get the return value -1.

       

      What does it mean? There is no -1 listed in the documentation of the visibility values (swComponentVisibilityState_e Enumeration).

       

      And when does it happen?

       

      I have an assembly where the component that gives visibility -1...

      - ...is a top level component

      - ...is not suppressed

      - ...has a real name, i.e. not "".

      - ...has a real ID (get it via IComponent2.GetID()), i.e. the ID is not -1.

       

      Unfortunately I cannot attach the model since it is owned by a customer.

       

      Is there anyone who experienced this behaviour or knows something about this?

        • Re: Component2.GetVisibility returns -1
          Patrik MacHalec

          Hi Jana,

          another reason why you got value -1 is that configuration of component was renamed or deleted.

          If you use (int)swInConfigurationOpts_e.swThisConfiguration instead of (int)swInConfigurationOpts_e.swSpecifyConfiguration it should work. I assume that you have a reason to use "swSpecifyConfiguration".

          I do not have knowledge how to solve it.