88using Perfolizer . Models ;
99using static System . Runtime . InteropServices . RuntimeInformation ;
1010using RuntimeEnvironment = Microsoft . DotNet . PlatformAbstractions . RuntimeEnvironment ;
11+ using System . Runtime . Versioning ;
1112
1213namespace BenchmarkDotNet . Detectors ;
1314
@@ -113,29 +114,24 @@ private static bool IsUnderWsl()
113114 return null ;
114115 }
115116
116- #if NET6_0_OR_GREATER
117- [ System . Runtime . Versioning . SupportedOSPlatformGuard ( "windows" ) ]
118- #endif
117+ [ SupportedOSPlatformGuard ( "windows" ) ]
119118 internal static bool IsWindows ( ) =>
120119#if NET6_0_OR_GREATER
121120 OperatingSystem . IsWindows ( ) ; // prefer linker-friendly OperatingSystem APIs
122121#else
123122 IsOSPlatform ( OSPlatform . Windows ) ;
124123#endif
125124
126- #if NET6_0_OR_GREATER
127- [ System . Runtime . Versioning . SupportedOSPlatformGuard ( "linux" ) ]
128- #endif
125+
126+ [ SupportedOSPlatformGuard ( "linux" ) ]
129127 internal static bool IsLinux ( ) =>
130128#if NET6_0_OR_GREATER
131129 OperatingSystem . IsLinux ( ) ;
132130#else
133131 IsOSPlatform ( OSPlatform . Linux ) ;
134132#endif
135133
136- #if NET6_0_OR_GREATER
137- [ System . Runtime . Versioning . SupportedOSPlatformGuard ( "macos" ) ]
138- #endif
134+ [ SupportedOSPlatformGuard ( "macos" ) ]
139135 // ReSharper disable once InconsistentNaming
140136 internal static bool IsMacOS ( ) =>
141137#if NET6_0_OR_GREATER
@@ -144,19 +140,15 @@ internal static bool IsMacOS() =>
144140 IsOSPlatform ( OSPlatform . OSX ) ;
145141#endif
146142
147- #if NET6_0_OR_GREATER
148- [ System . Runtime . Versioning . SupportedOSPlatformGuard ( "android" ) ]
149- #endif
143+ [ SupportedOSPlatformGuard ( "android" ) ]
150144 internal static bool IsAndroid ( ) =>
151145#if NET6_0_OR_GREATER
152146 OperatingSystem . IsAndroid ( ) ;
153147#else
154148 Type . GetType ( "Java.Lang.Object, Mono.Android" ) != null ;
155149#endif
156150
157- #if NET6_0_OR_GREATER
158- [ System . Runtime . Versioning . SupportedOSPlatformGuard ( "ios" ) ]
159- #endif
151+ [ SupportedOSPlatformGuard ( "ios" ) ]
160152 // ReSharper disable once InconsistentNaming
161153 internal static bool IsIOS ( ) =>
162154#if NET6_0_OR_GREATER
@@ -165,9 +157,7 @@ internal static bool IsIOS() =>
165157 Type . GetType ( "Foundation.NSObject, Xamarin.iOS" ) != null ;
166158#endif
167159
168- #if NET6_0_OR_GREATER
169- [ System . Runtime . Versioning . SupportedOSPlatformGuard ( "tvos" ) ]
170- #endif
160+ [ SupportedOSPlatformGuard ( "tvos" ) ]
171161 // ReSharper disable once InconsistentNaming
172162 internal static bool IsTvOS ( ) =>
173163#if NET6_0_OR_GREATER
0 commit comments