Exception has been thrown by the target of an invocation.
-
I did some cleanup in my code, and now I'm getting the above error message, but I'm having trouble seeing the reason. I searched the internet and found this article, but I don't see that I'm having that issue. http://www.softwareandfinance.com/forums/index.php?topic=314.0[^] In my Program.cs class, I have the following lines of code.
Control control = new Control(); Assembly \_assembly = Assembly.LoadFrom(programDll); Type \_type = \_assembly.GetType("CWriter.ProgramControl"); //problem here? Object \_objectInstance = Activator.CreateInstance(\_type); //exception thrown
I tried adding a breakpoint in the ProgramControl constructor, but it doesn't get hit. The constructor doesn't have any arguments to it.
-
I did some cleanup in my code, and now I'm getting the above error message, but I'm having trouble seeing the reason. I searched the internet and found this article, but I don't see that I'm having that issue. http://www.softwareandfinance.com/forums/index.php?topic=314.0[^] In my Program.cs class, I have the following lines of code.
Control control = new Control(); Assembly \_assembly = Assembly.LoadFrom(programDll); Type \_type = \_assembly.GetType("CWriter.ProgramControl"); //problem here? Object \_objectInstance = Activator.CreateInstance(\_type); //exception thrown
I tried adding a breakpoint in the ProgramControl constructor, but it doesn't get hit. The constructor doesn't have any arguments to it.
Wrap the Activator.CreateInstance in a try/catch block and then take a look at the full exception. Is there an
InnerException
that provides more details (there should be)?*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier
-
Wrap the Activator.CreateInstance in a try/catch block and then take a look at the full exception. Is there an
InnerException
that provides more details (there should be)?*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier