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

Posted Jan 2, 2015, 1:56 AM EST
Can you please try the below code?
Barkha Shukla16 reputationPosted Jan 2, 2015, 3:01 AM EST
VulpesRank #55 · 29.2K reputationPosted Jan 2, 2015, 3:12 AM EST
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 Shukla16 reputationPosted Jan 2, 2015, 3:15 AM EST
VulpesRank #55 · 29.2K reputationPosted Jan 2, 2015, 3:54 AM EST
Barkha Shukla16 reputationPosted Jan 4, 2015, 1:20 AM EST
Barkha Shukla16 reputationPosted Jan 4, 2015, 1:20 AM EST
VulpesRank #55 · 29.2K reputationPosted Jan 4, 2015, 10:51 AM EST
}
}
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 Shukla16 reputationPosted Jan 4, 2015, 6:03 PM EST