internal void FormatWorkerPathIfNeeded(ISystemRuntimeInformation systemRuntimeInformation, IEnvironment environment, ILogger logger)
        {
            if (string.IsNullOrEmpty(DefaultWorkerPath))
            {
                return;
            }

            OSPlatform   os            = systemRuntimeInformation.GetOSPlatform();
            Architecture architecture  = systemRuntimeInformation.GetOSArchitecture();
            string       workerRuntime = environment.GetEnvironmentVariable(RpcWorkerConstants.FunctionWorkerRuntimeSettingName);
            string       version       = environment.GetEnvironmentVariable(RpcWorkerConstants.FunctionWorkerRuntimeVersionSettingName);

            logger.LogDebug($"EnvironmentVariable {RpcWorkerConstants.FunctionWorkerRuntimeVersionSettingName}: {version}");

            // Only over-write DefaultRuntimeVersion if workerRuntime matches language for the worker config
            if (!string.IsNullOrEmpty(workerRuntime) && workerRuntime.Equals(Language, StringComparison.OrdinalIgnoreCase) && !string.IsNullOrEmpty(version))
            {
                DefaultRuntimeVersion = GetSanitizedRuntimeVersion(version);
            }

            ValidateDefaultWorkerPathFormatters(systemRuntimeInformation);

            DefaultWorkerPath = DefaultWorkerPath.Replace(RpcWorkerConstants.OSPlaceholder, os.ToString())
                                .Replace(RpcWorkerConstants.ArchitecturePlaceholder, architecture.ToString())
                                .Replace(RpcWorkerConstants.RuntimeVersionPlaceholder, DefaultRuntimeVersion);
        }
        internal void ValidateDefaultWorkerPathFormatters(ISystemRuntimeInformation systemRuntimeInformation)
        {
            if (DefaultWorkerPath.Contains(RpcWorkerConstants.OSPlaceholder))
            {
                ValidateOSPlatform(systemRuntimeInformation.GetOSPlatform());
            }

            if (DefaultWorkerPath.Contains(RpcWorkerConstants.ArchitecturePlaceholder))
            {
                ValidateArchitecture(systemRuntimeInformation.GetOSArchitecture());
            }

            if (DefaultWorkerPath.Contains(RpcWorkerConstants.RuntimeVersionPlaceholder) && !string.IsNullOrEmpty(DefaultRuntimeVersion))
            {
                ValidateRuntimeVersion();
            }
        }
        internal void FormatWorkerPathIfNeeded(ISystemRuntimeInformation systemRuntimeInformation, IEnvironment environment, ILogger logger)
        {
            if (string.IsNullOrEmpty(DefaultWorkerPath))
            {
                return;
            }

            OSPlatform   os           = systemRuntimeInformation.GetOSPlatform();
            Architecture architecture = systemRuntimeInformation.GetOSArchitecture();
            string       version      = environment.GetEnvironmentVariable(RpcWorkerConstants.FunctionWorkerRuntimeVersionSettingName);

            logger.LogDebug($"EnvironmentVariable {RpcWorkerConstants.FunctionWorkerRuntimeVersionSettingName}: {version}");

            if (!string.IsNullOrEmpty(version))
            {
                DefaultRuntimeVersion = version;
            }

            ValidateDefaultWorkerPathFormatters(systemRuntimeInformation);

            DefaultWorkerPath = DefaultWorkerPath.Replace(RpcWorkerConstants.OSPlaceholder, os.ToString())
                                .Replace(RpcWorkerConstants.ArchitecturePlaceholder, architecture.ToString())
                                .Replace(RpcWorkerConstants.RuntimeVersionPlaceholder, DefaultRuntimeVersion);
        }