AssemblyName assembly = new AssemblyName();
var myAssembly = Assembly.Load(@"D:\MyLabBeDevelopmet1.0\Test\bin\Debug\MongoDBLogger.dll");
EventNotifier.IEventNotifier eventNotifier = myAssembly.CreateInstance("MongoDBLogger.Logger") as EventNotifier.IEventNotifier;
eventNotifier.Log(FinalXML);
Loading
Barkha ShuklaPosted Jan 4, 2015, 11:03 PM
VulpesPosted Jan 4, 2015, 3:51 PM
}
}
I tried the code myself and it compiled fine.
So the only other reason I can think of for this error is that you're not using the System.Reflection.Assembly class in the .NET framework but a 'custom' Assembly class which:
1. May or may not inherit from the former.
2. Has a Load method which returns an object rather than an Assembly.
Am I close here?
Barkha ShuklaPosted Jan 4, 2015, 6:20 AM
Barkha ShuklaPosted Jan 4, 2015, 6:20 AM
VulpesPosted Jan 2, 2015, 8:54 AM
Barkha ShuklaPosted Jan 2, 2015, 8:15 AM
VulpesPosted Jan 2, 2015, 8:12 AM
I think the error must therefore be bubbling up from inside one of the methods you're calling.
What's the 'full' error message here?
Barkha ShuklaPosted Jan 2, 2015, 8:01 AM
Posted Jan 2, 2015, 6:56 AM
Can you please try the below code?