This documentation is archived and is not being maintained.

AppDomain.CreateComInstanceFrom Method (String, String, Byte[], AssemblyHashAlgorithm)

Creates a new instance of a specified COM type. Parameters specify the name of a file that contains an assembly containing the type and the name of the type.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

public ObjectHandle CreateComInstanceFrom (
	string assemblyFile,
	string typeName,
	byte[] hashValue,
	AssemblyHashAlgorithm hashAlgorithm
)
public ObjectHandle CreateComInstanceFrom (
	String assemblyFile, 
	String typeName, 
	byte[] hashValue, 
	AssemblyHashAlgorithm hashAlgorithm
)
public function CreateComInstanceFrom (
	assemblyFile : String, 
	typeName : String, 
	hashValue : byte[], 
	hashAlgorithm : AssemblyHashAlgorithm
) : ObjectHandle

Parameters

assemblyFile

The name of a file containing an assembly that defines the requested type.

typeName

The name of the requested type.

hashValue

Represents the value of the computed hash code.

hashAlgorithm

Represents the hash algorithm used by the assembly manifest.

Return Value

An object that is a wrapper for the new instance specified by typeName. The return value needs to be unwrapped to access the real object.

Exception typeCondition

ArgumentNullException

assemblyName or typeName is a null reference (Nothing in Visual Basic).

TypeLoadException

The type cannot be loaded.

AppDomainUnloadedException

Operations are attempted on an unloaded application domain.

MissingMethodException

No public parameterless constructor was found.

FileNotFoundException

assemblyFile is not found.

MemberAccessException

typeName is an abstract class.

-or-

This member was invoked with a late-binding mechanism.

NotSupportedException

The caller cannot provide activation attributes for an object that does not inherit from MarshalByRefObject.

ArgumentException

assemblyFile is the empty string ("").

BadImageFormatException

assemblyFile is not a valid assembly.

FileLoadException

An assembly or module was loaded twice with two different evidences.

Use this method to create objects remotely without having to load the type locally.

The return value must to be unwrapped to access the real object.

A System.Runtime.InteropServices.ComVisibleAttribute attribute with a value of true must be applied either explicitly or by default to the COM type for this method to create an instance of that type; otherwise, TypeLoadException is thrown.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1
Show: