Repository: dotnet/runtime
File: src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs (C#)

Code before:
                                                                        && !RuntimeInformation.RuntimeIdentifier.StartsWith("tvossimulator");
#else
        public static bool FileCreateCaseSensitive => IsCaseSensitiveOS;
#endif

#if NET11_0_OR_GREATER
        public static bool IsMultithreadingSupported => RuntimeFeature.IsMultithreadingSupported;
#else
        public static bool IsMultithreadingSupported
        {
            get
            {
                if (!IsWasm)
                    return true;

                try
                {
                    Type runtimeFeatureType = typeof(object).Assembly.GetType("System.Runtime.CompilerServices.RuntimeFeature");
                    if (runtimeFeatureType != null)
                    {
                        var isMultithreadingSupportedProperty = runtimeFeatureType.GetProperty("IsMultithreadingSupported", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
                        if (isMultithreadingSupportedProperty != null)
                        {
                            return (bool)isMultithreadingSupportedProperty.GetValue(null);
                        }
                    }
                }
                catch
                {
                    // if any of the reflection calls fail, assume multithreading is not supported.
                }
                return false;
            }
        }
#endif
        public static bool IsNotMultithreadingSupported => !IsMultithreadingSupported;
        public static bool IsWasmThreadingSupported => IsBrowser && IsMultithreadingSupported;
        public static bool IsNotWasmThreadingSupported => !IsWasmThreadingSupported;

        private static readonly Lazy<bool> s_isBinaryFormatterSupported = new Lazy<bool>(DetermineBinaryFormatterSupport);
        public static bool IsBinaryFormatterSupported => s_isBinaryFormatterSupported.Value;

        public static bool IsStartingProcessesSupported => !IsiOS && !IstvOS;

        public static bool IsLinqSpeedOptimized => !IsLinqSizeOptimized;
        public static bool IsLinqSizeOptimized => s_linqIsSizeOptimized.Value;
        private static readonly Lazy<bool> s_linqIsSizeOptimized = new Lazy<bool>(ComputeIsLinqSizeOptimized);
        private static bool ComputeIsLinqSizeOptimized()
        {
#if NET
            return (bool)typeof(Enumerable).GetMethod("get_IsSizeOptimized", BindingFlags.NonPublic | BindingFlags.Static).Invoke(null, Array.Empty<object>());

Review comment (suggestion):
```suggestion
                    Type runtimeFeatureType = typeof(System.Runtime.CompilerServices.RuntimeFeature);

                    PropertyInfo isMultithreadingSupportedProperty = runtimeFeatureType.GetProperty("IsMultithreadingSupported", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
                    if (isMultithreadingSupportedProperty != null)
                    {
                        return (bool)isMultithreadingSupportedProperty.GetValue(null);
                    }
```
RuntimeFeature exists everywhere. It is just the property that's the problem.

Code after:
                                                                        && !RuntimeInformation.RuntimeIdentifier.StartsWith("tvossimulator");
#else
        public static bool FileCreateCaseSensitive => IsCaseSensitiveOS;
#endif

#if NET11_0_OR_GREATER
        public static bool IsMultithreadingSupported => RuntimeFeature.IsMultithreadingSupported;
#else
        public static bool IsMultithreadingSupported { get; } = GetIsMultithreadingSupported();

        private static bool GetIsMultithreadingSupported()
        {
            if (!IsWasm)
                return true;

            try
            {
                Type runtimeFeatureType = typeof(System.Runtime.CompilerServices.RuntimeFeature);

                PropertyInfo isMultithreadingSupportedProperty = runtimeFeatureType.GetProperty("IsMultithreadingSupported", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
                if (isMultithreadingSupportedProperty != null)
                {
                    return (bool)isMultithreadingSupportedProperty.GetValue(null);
                }
            }
            catch
            {
                // if any of the reflection calls fail, assume multithreading is not supported.
            }
            return false;
        }
#endif
        public static bool IsNotMultithreadingSupported => !IsMultithreadingSupported;
        public static bool IsWasmThreadingSupported => IsWasm && IsMultithreadingSupported;
        public static bool IsNotWasmThreadingSupported => !IsWasmThreadingSupported;

        private static readonly Lazy<bool> s_isBinaryFormatterSupported = new Lazy<bool>(DetermineBinaryFormatterSupport);
        public static bool IsBinaryFormatterSupported => s_isBinaryFormatterSupported.Value;

        public static bool IsStartingProcessesSupported => !IsiOS && !IstvOS;

        public static bool IsLinqSpeedOptimized => !IsLinqSizeOptimized;
        public static bool IsLinqSizeOptimized => s_linqIsSizeOptimized.Value;
        private static readonly Lazy<bool> s_linqIsSizeOptimized = new Lazy<bool>(ComputeIsLinqSizeOptimized);
        private static bool ComputeIsLinqSizeOptimized()
        {
#if NET
            return (bool)typeof(Enumerable).GetMethod("get_IsSizeOptimized", BindingFlags.NonPublic | BindingFlags.Static).Invoke(null, Array.Empty<object>());
#else
            return false;
#endif