Repository: dotnet/runtime
File: src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeFeature.cs (C#)

Code before:
                ByRefFields or
                ByRefLikeGenerics or
                UnmanagedSignatureCallingConvention or
                DefaultImplementationsOfInterfaces or
                VirtualStaticsInInterfaces or
                NumericIntPtr => true,

                nameof(IsDynamicCodeSupported) => IsDynamicCodeSupported,
                nameof(IsDynamicCodeCompiled) => IsDynamicCodeCompiled,
                nameof(IsMultithreadingSupported) => IsMultithreadingSupported,
                _ => false,
            };
        }


        /// <summary>
        /// Gets a value that indicates whether the runtime supports multithreading, including
        /// creating threads and using blocking synchronization primitives. This property
        /// returns <see langword="false"/> on platforms or configurations where multithreading
        /// is not supported or is disabled, such as single-threaded browser environments and WASI.
        /// </summary>
        [UnsupportedOSPlatformGuard("browser")]
        [UnsupportedOSPlatformGuard("wasi")]
        [FeatureSwitchDefinition("System.Runtime.CompilerServices.RuntimeFeature.IsMultithreadingSupported")]
        public static bool IsMultithreadingSupported { get; }
#if TARGET_BROWSER
            = AppContext.TryGetSwitch("System.Runtime.CompilerServices.RuntimeFeature.IsMultithreadingSupported", out bool isMultithreadingSupported) ? isMultithreadingSupported : true;
#elif TARGET_WASI
            = false;
#else
            = true;
#endif

#if FEATURE_SINGLE_THREADED
        [DoesNotReturn]
        internal static void ThrowIfMultithreadingIsNotSupported()
        {
            throw new PlatformNotSupportedException();
        }
#else // FEATURE_SINGLE_THREADED
        internal static void ThrowIfMultithreadingIsNotSupported()
        {
#if FEATURE_WASM_MANAGED_THREADS
            System.Threading.Thread.AssureBlockingPossible();
#endif // FEATURE_WASM_MANAGED_THREADS
        }
#endif // FEATURE_SINGLE_THREADED
    }
}


Review comment (suggestion):
I think this should also have FEATURE_SINGLE_THREADED check and branch here.

Code after:
                CovariantReturnsOfClasses or
                ByRefFields or
                ByRefLikeGenerics or
                UnmanagedSignatureCallingConvention or
                DefaultImplementationsOfInterfaces or
                VirtualStaticsInInterfaces or
                NumericIntPtr => true,

                nameof(IsDynamicCodeSupported) => IsDynamicCodeSupported,
                nameof(IsDynamicCodeCompiled) => IsDynamicCodeCompiled,
                nameof(IsMultithreadingSupported) => IsMultithreadingSupported,
                _ => false,
            };
        }

        /// <summary>
        /// Gets a value that indicates whether the runtime supports multithreading, including
        /// creating threads and using blocking synchronization primitives. This property
        /// returns <see langword="false"/> on platforms or configurations where multithreading
        /// is not supported or is disabled, such as single-threaded browser environments and WASI.
        /// </summary>
        [UnsupportedOSPlatformGuard("browser")]
        [UnsupportedOSPlatformGuard("wasi")]
        [FeatureSwitchDefinition("System.Runtime.CompilerServices.RuntimeFeature.IsMultithreadingSupported")]
        public static bool IsMultithreadingSupported
#if FEATURE_SINGLE_THREADED
            => false;
#else
            => true;
#endif

#if FEATURE_SINGLE_THREADED
        [DoesNotReturn]
        internal static void ThrowIfMultithreadingIsNotSupported()
        {
            throw new PlatformNotSupportedException();
        }
#elif FEATURE_WASM_MANAGED_THREADS
        internal static void ThrowIfMultithreadingIsNotSupported()
        {
            System.Threading.Thread.AssureBlockingPossible();
        }
#else
        [Conditional("unnecessary")]
        internal static void ThrowIfMultithreadingIsNotSupported()
        {
        }
#endif
    }
}