Skip to main content

InstallerHandle Class

Base class for Windows Installer handle types (Database, View, Record, SummaryInfo).

Methods

MethodDescription
Close()Closes the handle. After closing a handle, further method calls may throw an «see T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException» .
Dispose()Closes the handle. After closing a handle, further method calls may throw an «see T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException» .
Dispose(disposing)Closes the handle. After closing a handle, further method calls may throw an «see T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException» .
Equals(obj)Tests whether this handle object is equal to another handle object. Two handle objects are equal if their types are the same and their native integer handles are the same.
GetHashCode()Gets a hash value for the handle object.

Properties

PropertyDescription
HandleGets the native integer handle.
IsClosedChecks if the handle is closed. When closed, method calls on the handle object may throw an «see T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException» .

Remarks

These classes implement the «see T:System.IDisposable» interface, because they hold unmanaged resources (MSI handles) that should be properly disposed when no longer needed.

WixToolset.Dtf.WindowsInstaller.dll version 5.0.0+41e11442b2ca93e444b60213b5ae99dcbab787d8

Close() Method

Closes the handle. After closing a handle, further method calls may throw an «see T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException» .

Declaration

public void Close()

Remarks

The finalizer of this class will NOT close the handle if it is still open, because finalization can run on a separate thread from the application, resulting in potential problems if handles are closed from that thread. It is best that the handle be closed manually as soon as it is no longer needed, as leaving lots of unused handles open can degrade performance. This method is merely an alias for the «see M:WixToolset.Dtf.WindowsInstaller.InstallerHandle.Dispose» method. Win32 MSI API: MsiCloseHandle

Dispose() Method

Closes the handle. After closing a handle, further method calls may throw an «see T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException» .

Declaration

public void Dispose()

Remarks

The finalizer of this class will NOT close the handle if it is still open, because finalization can run on a separate thread from the application, resulting in potential problems if handles are closed from that thread. It is best that the handle be closed manually as soon as it is no longer needed, as leaving lots of unused handles open can degrade performance. Win32 MSI API: MsiCloseHandle

See also

  • M:WixToolset.Dtf.WindowsInstaller.InstallerHandle.Close

Dispose(disposing) Method

Closes the handle. After closing a handle, further method calls may throw an «see T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException» .

Declaration

protected void Dispose(
bool disposing
)

Parameters

ParameterTypeDescription
disposingboolIf true, the method has been called directly or indirectly by a user's code, so managed and unmanaged resources will be disposed. If false, the method has been called by the runtime from inside the finalizer, and only unmanaged resources will be disposed.

Equals(obj) Method

Tests whether this handle object is equal to another handle object. Two handle objects are equal if their types are the same and their native integer handles are the same.

Declaration

public bool Equals(
System.Object obj
)

Parameters

ParameterTypeDescription
objSystem.ObjectThe handle object to compare with the current handle object.

Return value

bool true if the specified handle object is equal to the current handle object; otherwise false

GetHashCode() Method

Gets a hash value for the handle object.

Declaration

public int GetHashCode()

Return value

int A hash code for the handle object.

Remarks

The hash code is derived from the native integer handle.

Handle Property

Gets the native integer handle.

Declaration

public IntPtr Handle { get; set; } 

IsClosed Property

Checks if the handle is closed. When closed, method calls on the handle object may throw an «see T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException» .

Declaration

public bool IsClosed { get; set; }