I was initially using the following method – which was working fine
var obj = Activator.CreateInstance("MyProject","MyProject.MyImpl");
Now I am getting an error at the above line and the error is:
Exception has been thrown by the target of an invocation.
Any suggestions on what might be going wrong ?
The easiest would be to set a breakpoint in the constructor of the
MyImplclass and debug it.One tricky problem you might be having is if the exception is actually not thrown directly by the constructor, but by some field initializer.
For example the following would cause the behavior you described, even though there is no explicit constructor that could throw anything.