private static ObjectHandle CreateInstanceFrom(string assemblyFile, string typeName, bool ignoreCase, Reflection.BindingFlags bindingAttr, Reflection.Binder binder, object[] args, Globalization.CultureInfo culture, object[] activationAttributes) { return(CreateInstanceFromInternal(assemblyFile, typeName, ignoreCase, bindingAttr, binder, args, culture, activationAttributes, null)); }
private static ObjectHandle CreateInstanceFromInternal(String assemblyFile, String typeName, bool ignoreCase, Reflection.BindingFlags bindingAttr, Reflection.Binder binder, Object[] args, Globalization.CultureInfo culture, Object[] activationAttributes, Security.Policy.Evidence securityInfo) { #if FEATURE_CAS_POLICY Contract.Assert(AppDomain.CurrentDomain.IsLegacyCasPolicyEnabled || securityInfo == null); #endif // FEATURE_CAS_POLICY #pragma warning disable 618 Reflection.Assembly assembly = Reflection.Assembly.LoadFrom(assemblyFile); //, securityInfo); #pragma warning restore 618 Type t = assembly.GetType(typeName, true, ignoreCase); Object o = Activator.CreateInstance(t, bindingAttr, binder, args, culture, activationAttributes); // Log(o != null, "CreateInstanceFrom:: ", "Created Instance of class " + typeName, "Failed to create instance of class " + typeName); if (o == null) { return(null); } else { ObjectHandle Handle = new ObjectHandle(o); return(Handle); } }