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

Code before:
            return false;
        }

        private static bool GetIsRunningOnMonoInterpreter()
        {
#if NET
            return IsMonoRuntime && RuntimeFeature.IsDynamicCodeSupported && !RuntimeFeature.IsDynamicCodeCompiled;
#else
            return false;
#endif
        }

        private static string GetEnvironmentVariableValue(string name, string defaultValue = "0") =>
        Environment.GetEnvironmentVariable("DOTNET_" + name) ?? Environment.GetEnvironmentVariable("COMPlus_" + name) ?? defaultValue;

        private static bool GetIsRunningOnCoreClrInterpreter()
        {
            if (IsCoreCLR)
            {
                if (!string.IsNullOrWhiteSpace(GetEnvironmentVariableValue("Interpreter", "")))
                    return true;
                if (int.TryParse(GetEnvironmentVariableValue("InterpMode", "0"), out int mode) && (mode > 0))
                    return true;
            }

            return false;
        }

        private static bool IsEnvironmentVariableTrue(string variableName)
        {
            if (!IsBrowser)
                return false;

            return Environment.GetEnvironmentVariable(variableName) is "true";
        }

        private static string GetNodeJSPlatform()
        {
            if (!IsNodeJS)
                return null;

            return Environment.GetEnvironmentVariable("NodeJSPlatform");
        }

        private static bool AssemblyConfigurationEquals(string configuration)
        {
            AssemblyConfigurationAttribute assemblyConfigurationAttribute = typeof(string).Assembly.GetCustomAttribute<AssemblyConfigurationAttribute>();

            return assemblyConfigurationAttribute != null &&
                string.Equals(assemblyConfigurationAttribute.Configuration, configuration, StringComparison.InvariantCulture);
        }

Review comment (refactor):
[nitpick] The `GetEnvironmentVariableValue` helper method introduced here is only used twice in the same method. Consider inlining these calls to `Environment.GetEnvironmentVariable` directly in `GetIsRunningOnCoreClrInterpreter()` to avoid introducing a potentially confusing general-purpose helper that isn't reused elsewhere in the file.
```suggestion
        private static bool GetIsRunningOnCoreClrInterpreter()
        {
            if (IsCoreCLR)
            {
                if (!string.IsNullOrWhiteSpace(
                    Environment.GetEnvironmentVariable("DOTNET_Interpreter") ??
                    Environment.GetEnvironmentVariable("COMPlus_Interpreter") ?? ""))
                    return true;
                if (int.TryParse(
                    Environment.GetEnvironmentVariable("DOTNET_InterpMode") ??
                    Environment.GetEnvironmentVariable("COMPlus_InterpMode") ?? "0",
                    out int mode) && (mode > 0))
```

Code after:
            return false;
        }

        private static bool GetIsRunningOnMonoInterpreter()
        {
#if NET
            return IsMonoRuntime && RuntimeFeature.IsDynamicCodeSupported && !RuntimeFeature.IsDynamicCodeCompiled;
#else
            return false;
#endif
        }

        private static string GetEnvironmentVariableValue(string name, string defaultValue = "0") =>
            Environment.GetEnvironmentVariable("DOTNET_" + name) ?? Environment.GetEnvironmentVariable("COMPlus_" + name) ?? defaultValue;

        private static bool GetIsRunningOnCoreClrInterpreter()
        {
            if (IsCoreCLR)
            {
#if NET
                if (RuntimeFeature.IsDynamicCodeSupported && !RuntimeFeature.IsDynamicCodeCompiled)
                    return true;
#endif
                if (!string.IsNullOrWhiteSpace(GetEnvironmentVariableValue("Interpreter", "")))
                    return true;
                if (int.TryParse(GetEnvironmentVariableValue("InterpMode", "0"), out int mode) && (mode > 0))
                    return true;
            }

            return false;
        }

        private static bool IsEnvironmentVariableTrue(string variableName)
        {
            if (!IsBrowser)
                return false;

            return Environment.GetEnvironmentVariable(variableName) is "true";
        }

        private static string GetNodeJSPlatform()
        {
            if (!IsNodeJS)
                return null;

            return Environment.GetEnvironmentVariable("NodeJSPlatform");
        }

        private static bool AssemblyConfigurationEquals(string configuration)
        {
            AssemblyConfigurationAttribute assemblyConfigurationAttribute = typeof(string).Assembly.GetCustomAttribute<AssemblyConfigurationAttribute>();