Activator.CreateInstance throwing exception

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am migrating my app from CF1 to CF2. My app. worked fine in CF1....but in
CF2,
Activator.CreateInstance throws and InvalidCastException.
Has someone come across such a problem?

-Thanks
 
I came to know that InvalidCastException was an exception thrown by my code...
I was doing this in a function, which was throwing the exception.
return (MyInterface)Activator.CreateInstance(MyType).

Now instead, I am doing this....
object obj = Activator.CreateInstance(MyType);
return (MyInterface)obj;

I don't know how it was working earlier....
Anyways....thanks to all who thought about my problem.
 
Back
Top