Skip to content

Commit bcd79f0

Browse files
author
Mitchell Hwang
committed
System.Runtime Mark APIs Supported on Windows
1 parent c373235 commit bcd79f0

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

src/coreclr/src/System.Private.CoreLib/src/System/Type.CoreCLR.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Diagnostics.CodeAnalysis;
55
using System.Reflection;
66
using System.Runtime.CompilerServices;
7+
using System.Runtime.Versioning;
78
using StackCrawlMark = System.Threading.StackCrawlMark;
89

910
namespace System
@@ -89,6 +90,7 @@ public bool IsInterface
8990
// param progID: the progID of the class to retrieve
9091
// returns: the class object associated to the progID
9192
////
93+
[SupportedOSPlatform("windows")]
9294
public static Type? GetTypeFromProgID(string progID, string? server, bool throwOnError)
9395
{
9496
return RuntimeType.GetTypeFromProgIDImpl(progID, server, throwOnError);
@@ -101,6 +103,7 @@ public bool IsInterface
101103
// param CLSID: the CLSID of the class to retrieve
102104
// returns: the class object associated to the CLSID
103105
////
106+
[SupportedOSPlatform("windows")]
104107
public static Type? GetTypeFromCLSID(Guid clsid, string? server, bool throwOnError)
105108
{
106109
return RuntimeType.GetTypeFromCLSIDImpl(clsid, server, throwOnError);

src/libraries/System.Private.CoreLib/src/System/Type.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Reflection;
88
using System.Runtime.CompilerServices;
99
using System.Runtime.InteropServices;
10+
using System.Runtime.Versioning;
1011
using System.Threading;
1112

1213
namespace System
@@ -399,12 +400,18 @@ protected virtual TypeCode GetTypeCodeImpl()
399400

400401
public abstract Guid GUID { get; }
401402

403+
[SupportedOSPlatform("windows")]
402404
public static Type? GetTypeFromCLSID(Guid clsid) => GetTypeFromCLSID(clsid, null, throwOnError: false);
405+
[SupportedOSPlatform("windows")]
403406
public static Type? GetTypeFromCLSID(Guid clsid, bool throwOnError) => GetTypeFromCLSID(clsid, null, throwOnError: throwOnError);
407+
[SupportedOSPlatform("windows")]
404408
public static Type? GetTypeFromCLSID(Guid clsid, string? server) => GetTypeFromCLSID(clsid, server, throwOnError: false);
405409

410+
[SupportedOSPlatform("windows")]
406411
public static Type? GetTypeFromProgID(string progID) => GetTypeFromProgID(progID, null, throwOnError: false);
412+
[SupportedOSPlatform("windows")]
407413
public static Type? GetTypeFromProgID(string progID, bool throwOnError) => GetTypeFromProgID(progID, null, throwOnError: throwOnError);
414+
[SupportedOSPlatform("windows")]
408415
public static Type? GetTypeFromProgID(string progID, string? server) => GetTypeFromProgID(progID, server, throwOnError: false);
409416

410417
public abstract Type? BaseType { get; }

src/libraries/System.Runtime/ref/System.Runtime.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4325,14 +4325,22 @@ protected Type() { }
43254325
public static System.Type[] GetTypeArray(object[] args) { throw null; }
43264326
public static System.TypeCode GetTypeCode(System.Type? type) { throw null; }
43274327
protected virtual System.TypeCode GetTypeCodeImpl() { throw null; }
4328+
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
43284329
public static System.Type? GetTypeFromCLSID(System.Guid clsid) { throw null; }
4330+
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
43294331
public static System.Type? GetTypeFromCLSID(System.Guid clsid, bool throwOnError) { throw null; }
4332+
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
43304333
public static System.Type? GetTypeFromCLSID(System.Guid clsid, string? server) { throw null; }
4334+
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
43314335
public static System.Type? GetTypeFromCLSID(System.Guid clsid, string? server, bool throwOnError) { throw null; }
43324336
public static System.Type GetTypeFromHandle(System.RuntimeTypeHandle handle) { throw null; }
4337+
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
43334338
public static System.Type? GetTypeFromProgID(string progID) { throw null; }
4339+
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
43344340
public static System.Type? GetTypeFromProgID(string progID, bool throwOnError) { throw null; }
4341+
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
43354342
public static System.Type? GetTypeFromProgID(string progID, string? server) { throw null; }
4343+
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
43364344
public static System.Type? GetTypeFromProgID(string progID, string? server, bool throwOnError) { throw null; }
43374345
public static System.RuntimeTypeHandle GetTypeHandle(object o) { throw null; }
43384346
protected abstract bool HasElementTypeImpl();

src/mono/netcore/System.Private.CoreLib/src/System/Type.Mono.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Reflection;
55
using System.Diagnostics.CodeAnalysis;
66
using System.Runtime.CompilerServices;
7+
using System.Runtime.Versioning;
78
using System.Threading;
89

910
namespace System
@@ -96,8 +97,10 @@ public static Type GetTypeFromHandle(RuntimeTypeHandle handle)
9697
return internal_from_handle(handle.Value);
9798
}
9899

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

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

103106
internal virtual Type InternalResolve()

0 commit comments

Comments
 (0)