Skip to content

Commit 6356354

Browse files
jkotasJo Shields
authored and
Jo Shields
committed
Mark OperatingSystem.IsXXX properties as non-versionable (dotnet#68250)
It allows them to be inlined by the R2R compiler.
1 parent f1aeb28 commit 6356354

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ public static bool IsOSPlatformVersionAtLeast(string platform, int major, int mi
120120
/// <summary>
121121
/// Indicates whether the current application is running as WASM in a Browser.
122122
/// </summary>
123+
[NonVersionable]
123124
public static bool IsBrowser() =>
124125
#if TARGET_BROWSER
125126
true;
@@ -130,6 +131,7 @@ public static bool IsBrowser() =>
130131
/// <summary>
131132
/// Indicates whether the current application is running on Linux.
132133
/// </summary>
134+
[NonVersionable]
133135
public static bool IsLinux() =>
134136
#if TARGET_LINUX && !TARGET_ANDROID
135137
true;
@@ -140,6 +142,7 @@ public static bool IsLinux() =>
140142
/// <summary>
141143
/// Indicates whether the current application is running on FreeBSD.
142144
/// </summary>
145+
[NonVersionable]
143146
public static bool IsFreeBSD() =>
144147
#if TARGET_FREEBSD
145148
true;
@@ -156,6 +159,7 @@ public static bool IsFreeBSDVersionAtLeast(int major, int minor = 0, int build =
156159
/// <summary>
157160
/// Indicates whether the current application is running on Android.
158161
/// </summary>
162+
[NonVersionable]
159163
public static bool IsAndroid() =>
160164
#if TARGET_ANDROID
161165
true;
@@ -173,6 +177,7 @@ public static bool IsAndroidVersionAtLeast(int major, int minor = 0, int build =
173177
/// Indicates whether the current application is running on iOS or MacCatalyst.
174178
/// </summary>
175179
[SupportedOSPlatformGuard("maccatalyst")]
180+
[NonVersionable]
176181
public static bool IsIOS() =>
177182
#if TARGET_IOS || TARGET_MACCATALYST
178183
true;
@@ -184,12 +189,14 @@ public static bool IsIOS() =>
184189
/// Check for the iOS/MacCatalyst version (returned by 'libobjc.get_operatingSystemVersion') with a >= version comparison. Used to guard APIs that were added in the given iOS release.
185190
/// </summary>
186191
[SupportedOSPlatformGuard("maccatalyst")]
192+
[NonVersionable]
187193
public static bool IsIOSVersionAtLeast(int major, int minor = 0, int build = 0)
188194
=> IsIOS() && IsOSVersionAtLeast(major, minor, build, 0);
189195

190196
/// <summary>
191197
/// Indicates whether the current application is running on macOS.
192198
/// </summary>
199+
[NonVersionable]
193200
public static bool IsMacOS() =>
194201
#if TARGET_OSX
195202
true;
@@ -213,6 +220,7 @@ public static bool IsMacOSVersionAtLeast(int major, int minor = 0, int build = 0
213220
/// <summary>
214221
/// Indicates whether the current application is running on Mac Catalyst.
215222
/// </summary>
223+
[NonVersionable]
216224
public static bool IsMacCatalyst() =>
217225
#if TARGET_MACCATALYST
218226
true;
@@ -229,6 +237,7 @@ public static bool IsMacCatalystVersionAtLeast(int major, int minor = 0, int bui
229237
/// <summary>
230238
/// Indicates whether the current application is running on tvOS.
231239
/// </summary>
240+
[NonVersionable]
232241
public static bool IsTvOS() =>
233242
#if TARGET_TVOS
234243
true;
@@ -245,6 +254,7 @@ public static bool IsTvOSVersionAtLeast(int major, int minor = 0, int build = 0)
245254
/// <summary>
246255
/// Indicates whether the current application is running on watchOS.
247256
/// </summary>
257+
[NonVersionable]
248258
public static bool IsWatchOS() =>
249259
#if TARGET_WATCHOS
250260
true;
@@ -261,6 +271,7 @@ public static bool IsWatchOSVersionAtLeast(int major, int minor = 0, int build =
261271
/// <summary>
262272
/// Indicates whether the current application is running on Windows.
263273
/// </summary>
274+
[NonVersionable]
264275
public static bool IsWindows() =>
265276
#if TARGET_WINDOWS
266277
true;

0 commit comments

Comments
 (0)