AppDomain.CreateInstanceAndUnwrap Method (String, String, Boolean, BindingFlags, Binder, Object, CultureInfo, Object, Evidence)
Note: This API is now obsolete. The non-obsolete alternative is CreateInstanceAndUnwrap.
Creates a new instance of the specified type. Parameters specify the name of the type, and how it is found and created.
Assembly: mscorlib (in mscorlib.dll)
[<ObsoleteAttribute("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of CreateInstanceAndUnwrap which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")>] member CreateInstanceAndUnwrap : assemblyName:string * typeName:string * ignoreCase:bool * bindingAttr:BindingFlags * binder:Binder * args:Object * culture:CultureInfo * activationAttributes:Object * securityAttributes:Evidence -> Object
- Type: System.String
The fully qualified name of the requested type, including the namespace but not the assembly, as returned by the Type.FullName property.
- Type: System.Boolean
A Boolean value specifying whether to perform a case-sensitive search or not.
- Type: System.Reflection.BindingFlags
A combination of zero or more bit flags that affect the search for the typeName constructor. If bindingAttr is zero, a case-sensitive search for public constructors is conducted.
- Type: System.Reflection.Binder
An object that enables the binding, coercion of argument types, invocation of members, and retrieval of MemberInfo objects using reflection. If binder is null, the default binder is used.
- Type: System.Object
The arguments to pass to the constructor. This array of arguments must match in number, order, and type the parameters of the constructor to invoke. If the default constructor is preferred, args must be an empty array or null.
- Type: System.Globalization.CultureInfo
A culture-specific object used to govern the coercion of types. If culture is a null reference (Nothing in Visual Basic), the CultureInfo for the current thread is used.
- Type: System.Object
An array of one or more attributes that can participate in activation. Typically, an array that contains a single UrlAttribute object. The UrlAttribute specifies the URL that is required to activate a remote object.
- Type: System.Security.Policy.Evidence
Information used to authorize creation of typeName.
Return ValueType: System.Object
An instance of the object specified by typeName.
assemblyName or typeName is a null reference (Nothing in Visual Basic).
No matching constructor was found.
typename was not found in assemblyName.
assemblyName was not found.
The caller does not have permission to call this constructor.
The caller cannot provide activation attributes for an object that does not inherit from MarshalByRefObject.
The operation is attempted on an unloaded application domain.
assemblyName is not a valid assembly.
Version 2.0 or later of the common language runtime is currently loaded and assemblyName was compiled with a later version.
An assembly or module was loaded twice with two different evidences.
The activationAttributes parameter is related to client-activated objects; see Client Activation.
If you make an early-bound call to a method M of an object of type T1 that was returned by CreateInstanceAndUnwrap, and that method makes an early-bound call to a method of an object of type T2 in an assembly C other than the current assembly or the assembly containing T1, assembly C is loaded into the current application domain. This loading occurs even if the early-bound call to T1.M() was made in the body of a DynamicMethod, or in other dynamically generated code. If the current domain is the default domain, assembly C cannot be unloaded until the process ends. If the current domain later attempts to load assembly C, the load might fail.
for the ability to access the location of the assembly. Associated enumeration: FileIOPermissionAccess.PathDiscovery
for the ability to read the file containing the assembly manifest. Associated enumeration: FileIOPermissionAccess.Read
for the ability to access the location of the assembly if the assembly is not local.
for the ability to call unmanaged code when creating an instance of a delegate. Associated enumeration: SecurityPermissionFlag.UnmanagedCode
to load an assembly with evidence. Associated enumeration: SecurityPermissionFlag.ControlEvidence.
for the ability to invoke operations on all type members. Associated enumeration: ReflectionPermissionFlag.MemberAccess
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.