RuntimeEnvironment.GetRuntimeInterfaceAsIntPtr(Guid, Guid) Method

Definition

Caution

RuntimeEnvironment members SystemConfigurationFile, GetRuntimeInterfaceAsIntPtr, and GetRuntimeInterfaceAsObject are not supported and throw PlatformNotSupportedException.

Returns the specified interface on the specified class.

C#
[System.Obsolete("RuntimeEnvironment members SystemConfigurationFile, GetRuntimeInterfaceAsIntPtr, and GetRuntimeInterfaceAsObject are not supported and throw PlatformNotSupportedException.", DiagnosticId="SYSLIB0019", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static IntPtr GetRuntimeInterfaceAsIntPtr(Guid clsid, Guid riid);
C#
public static IntPtr GetRuntimeInterfaceAsIntPtr(Guid clsid, Guid riid);
C#
[System.Runtime.InteropServices.ComVisible(false)]
[System.Security.SecurityCritical]
public static IntPtr GetRuntimeInterfaceAsIntPtr(Guid clsid, Guid riid);

Parameters

clsid
Guid

The identifier for the desired class.

riid
Guid

The identifier for the desired interface.

Returns

IntPtr

An unmanaged pointer to the requested interface.

Attributes

Exceptions

.NET Core and .NET 5+ only: In all cases.

Remarks

The following table shows the supported combinations for clsid and riid.

clsid riid
CLSID_CorMetaDataDispenser IID_IMetaDataDispenser, IID_IMetaDataDispenserEx
CLSID_CorMetaDataDispenserRuntime IID_IMetaDataDispenser, IID_IMetaDataDispenserEx
CLSID_CorRuntimeHost IID_CorRuntimeHost
CLSID_CLRRuntimeHost IID_CLRRuntimeHost (not valid for the common language runtime that is provided by the .NET Framework 4), IID_CLRRuntimeHost3
CLSID_TypeNameFactory IID_TypeNameFactory
CLSID_CLRStrongName IID_CLRStrongName

GetRuntimeInterfaceAsIntPtr is similar to the GetRuntimeInterfaceAsObject method.

Applies to

Tuote Versiot (Vanhentunut)
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5 (6, 7, 8, 9, 10)
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1