Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using StackCrawlMark = System.Threading.StackCrawlMark;

namespace System
Expand Down Expand Up @@ -89,6 +90,7 @@ public bool IsInterface
// param progID: the progID of the class to retrieve
// returns: the class object associated to the progID
////
[SupportedOSPlatform("windows")]
public static Type? GetTypeFromProgID(string progID, string? server, bool throwOnError)
{
return RuntimeType.GetTypeFromProgIDImpl(progID, server, throwOnError);
Expand All @@ -101,6 +103,7 @@ public bool IsInterface
// param CLSID: the CLSID of the class to retrieve
// returns: the class object associated to the CLSID
////
[SupportedOSPlatform("windows")]
public static Type? GetTypeFromCLSID(Guid clsid, string? server, bool throwOnError)
{
return RuntimeType.GetTypeFromCLSIDImpl(clsid, server, throwOnError);
Expand Down
7 changes: 7 additions & 0 deletions src/libraries/System.Private.CoreLib/src/System/Type.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading;

namespace System
Expand Down Expand Up @@ -399,12 +400,18 @@ protected virtual TypeCode GetTypeCodeImpl()

public abstract Guid GUID { get; }

[SupportedOSPlatform("windows")]
public static Type? GetTypeFromCLSID(Guid clsid) => GetTypeFromCLSID(clsid, null, throwOnError: false);
[SupportedOSPlatform("windows")]
public static Type? GetTypeFromCLSID(Guid clsid, bool throwOnError) => GetTypeFromCLSID(clsid, null, throwOnError: throwOnError);
[SupportedOSPlatform("windows")]
public static Type? GetTypeFromCLSID(Guid clsid, string? server) => GetTypeFromCLSID(clsid, server, throwOnError: false);

[SupportedOSPlatform("windows")]
public static Type? GetTypeFromProgID(string progID) => GetTypeFromProgID(progID, null, throwOnError: false);
[SupportedOSPlatform("windows")]
public static Type? GetTypeFromProgID(string progID, bool throwOnError) => GetTypeFromProgID(progID, null, throwOnError: throwOnError);
[SupportedOSPlatform("windows")]
public static Type? GetTypeFromProgID(string progID, string? server) => GetTypeFromProgID(progID, server, throwOnError: false);

public abstract Type? BaseType { get; }
Expand Down
8 changes: 8 additions & 0 deletions src/libraries/System.Runtime/ref/System.Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4325,14 +4325,22 @@ protected Type() { }
public static System.Type[] GetTypeArray(object[] args) { throw null; }
public static System.TypeCode GetTypeCode(System.Type? type) { throw null; }
protected virtual System.TypeCode GetTypeCodeImpl() { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static System.Type? GetTypeFromCLSID(System.Guid clsid) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static System.Type? GetTypeFromCLSID(System.Guid clsid, bool throwOnError) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static System.Type? GetTypeFromCLSID(System.Guid clsid, string? server) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static System.Type? GetTypeFromCLSID(System.Guid clsid, string? server, bool throwOnError) { throw null; }
public static System.Type GetTypeFromHandle(System.RuntimeTypeHandle handle) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static System.Type? GetTypeFromProgID(string progID) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static System.Type? GetTypeFromProgID(string progID, bool throwOnError) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static System.Type? GetTypeFromProgID(string progID, string? server) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static System.Type? GetTypeFromProgID(string progID, string? server, bool throwOnError) { throw null; }
public static System.RuntimeTypeHandle GetTypeHandle(object o) { throw null; }
protected abstract bool HasElementTypeImpl();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Reflection;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Threading;

namespace System
Expand Down Expand Up @@ -96,8 +97,10 @@ public static Type GetTypeFromHandle(RuntimeTypeHandle handle)
return internal_from_handle(handle.Value);
}

[SupportedOSPlatform("windows")]
public static Type? GetTypeFromCLSID(Guid clsid, string? server, bool throwOnError) => throw new PlatformNotSupportedException();

[SupportedOSPlatform("windows")]
public static Type? GetTypeFromProgID(string progID, string? server, bool throwOnError) => throw new PlatformNotSupportedException();

internal virtual Type InternalResolve()
Expand Down