L
liorhal
i'm having a problem insatlling WMI schema in .Net.
i have a ClassLibrary solution, contains the definition of a class,
decorated with the instance attribute of WMI:
[assembly: Instrumented("root/XXX")]
namespace firstNamespace
{
[InstrumentationClass(InstrumentationType.Instance)]
public class someClass
{
public int member1;
public string member2;
}
[System.ComponentModel.RunInstaller(true)]
public class MyInstaller : DefaultManagementProjectInstaller { }
}
i use this dll as a reference in another solution, also contains a
definition of a WMI schema :
[assembly: Instrumented("root/CLS")]
namespace firstNamespace
{
[InstrumentationClass(InstrumentationType.Abstract)]
public class ComponentCustomClass { }
[InstrumentationClass(InstrumentationType.Instance)]
public class classInstance
{
public someClass mySomeClass;
}
//public class x : someClass { }
[System.ComponentModel.RunInstaller(true)]
public class MyInstaller : DefaultManagementProjectInstaller { }
}
and insatll the WMI schema in:
class Class2
{
public static void Main(string[] args)
{
classInstance instance = new classInstance();
//Exception accepted here:
System.Management.Instrumentation.Instrumentation.RegisterAssembly(
Assembly.GetAssembly(typeof(classInstance))
);
System.Management.Instrumentation.Instrumentation.Publish(instance);
}
}
when trying to install the schema i accept the following exception:
"The member 'mySomeClass' has a declaration that is not supported. Use
the IgnoreMember attribute. Parameter name: mySomeClass"
what can i do in order to solve it ?
when adding the line in comment (public class x : someClass { }) it
seems to install the schema correctly. why is that ? how to avoid the
spare inheritance ?
i have a ClassLibrary solution, contains the definition of a class,
decorated with the instance attribute of WMI:
[assembly: Instrumented("root/XXX")]
namespace firstNamespace
{
[InstrumentationClass(InstrumentationType.Instance)]
public class someClass
{
public int member1;
public string member2;
}
[System.ComponentModel.RunInstaller(true)]
public class MyInstaller : DefaultManagementProjectInstaller { }
}
i use this dll as a reference in another solution, also contains a
definition of a WMI schema :
[assembly: Instrumented("root/CLS")]
namespace firstNamespace
{
[InstrumentationClass(InstrumentationType.Abstract)]
public class ComponentCustomClass { }
[InstrumentationClass(InstrumentationType.Instance)]
public class classInstance
{
public someClass mySomeClass;
}
//public class x : someClass { }
[System.ComponentModel.RunInstaller(true)]
public class MyInstaller : DefaultManagementProjectInstaller { }
}
and insatll the WMI schema in:
class Class2
{
public static void Main(string[] args)
{
classInstance instance = new classInstance();
//Exception accepted here:
System.Management.Instrumentation.Instrumentation.RegisterAssembly(
Assembly.GetAssembly(typeof(classInstance))
);
System.Management.Instrumentation.Instrumentation.Publish(instance);
}
}
when trying to install the schema i accept the following exception:
"The member 'mySomeClass' has a declaration that is not supported. Use
the IgnoreMember attribute. Parameter name: mySomeClass"
what can i do in order to solve it ?
when adding the line in comment (public class x : someClass { }) it
seems to install the schema correctly. why is that ? how to avoid the
spare inheritance ?