Urgent -- Strange MissingMethodException -- Activator.CreateInstance
Posted on 2004-09-21
I have one baseclass derived from System.Windows.Forms.Form ---- suppose BaseOne
then i have another derivedClass derived from BaseOne --- suppose DerivedOne
Now, in a class i am passing the typeof(DerivedOne) and in that class,
through Activator.CreateInstance i am creating object of that derived class (which will default look for zero parameter constructor) --- and then explicitly convert it to the BaseOne type.
BaseOne myForm = (BaseOne)Activator.CreateInstance(typeof(DerivedOne));
All this works fine with my test project. and it is creating the object and converting to the BaseOne. But when i do the same thing with my Main project, it is not able to find the Constructor to create the Object and convert it to the BaseOne method.
The constructor is present there, still it is not able to find the zero parameter constructor to create object of the DerivedOne.
and is giving me "MissingMethodException" error.......
This is so strange that i can not tell you, because the same same same thing with the test project is working and not with the main project and it is not able to find the constructor to create object.
This is really some weird thing..........can anybody help me to solve this problem ??
Thanks in Advance.