activator

Call Activator.CreateInstance in a dll to intance class that reside inside Asp.Net App_Code

Help, here is the idea: External.dll IMyClass NewCreated = (IMyClass)Activator.CreateInstance(Namespace.MyClass).UnWrap(); Asp.Net WebSite App_Code Namespace.MyClass.cs Bin External.dll Is that even posible? I have tried, a lot of posible combinations, like: Assembly.GetCallingAssembly().CreateInstance("Namespa...

Unable to catch exception from Activator.CreateInstance.

OK, I admit it this code will just look weird to you, and that's because it is weird. This is just code to reproduce the behavior, not code I want to use. class Program { static void Main(string[] args) { try { Activator.CreateInstance(typeof(Func<int>), new object[] { new object(), IntPtr.Zero }); ...

Can't Instantiate Windsor Custom Component Activator

Hi, I'm getting an exception calling Resolve: KernelException: Could not instantiate custom activator Inner Exception: {"Constructor on type 'MyProj.MyAdapter`1[[MyProj.MyBusinessObject, MyAsm, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' not found."} There's definitely a public parameterless constructor there (and I've v...

SecurityException from Activator.CreateInstance(), How to grant permissons to Assembly?

I have been loading an assembly via Assembly.LoadFrom(@"path"); and then doing Type t = asm.GetType("Test.Test"); test = Activator.CreateInstance(t, new Object[] { ... }); and it was working fine, but now I moved the dll I am getting the following System.Reflection.TargetInvocationException: Exception has been thrown by the target o...

InvalidCastException of a Activator.CreateInstance object during an installation procedure

Hi I have the following procedure private static IMyInterface OpenInstance( string assemblyPath, string classType, string assemblyName, out AppDomain domainInstall) { IMyInterface interface = null; AppDomainSetup domaininfo = new AppDomainSetup(); domaininfo.ApplicationBase = assemblyPath; domainInstall = AppDomain.C...

Activator.CreateInstance: Dynamic Instantiation of Classes

I am designing a loosely-coupled structure. I want to call classes from different assemblies/namespaces via a code which is represented by a String. My design is, each of client's business rules is on different assemblies and not dependent on each other (ONE client is to ONE DLL ratio) so that when I made an update on business rules of 1...

Ninject, Providers and Activator.CreateInstance

I'm fairly new to Ninject, but I have successfully managed to use it for DI using a custom provider. The binding is initialised as follows kernel = new StandardKernel(); kernel.Bind<IPatientRecordLocator>().ToProvider<PatientRecordLocatorProvider>(); and in the custom provider I call Activator.CreateInstance like so protected over...

Is Activator.CreateInstance available in DotNet 3.5 ?

Do we have Activator.CreateInstance available in DotNet 3.5 ? ...