public static LaunchProfile Clone(ILaunchProfile profile)
        {
            // LaunchProfile is immutable and doesn't need to be cloned.
            if (profile is LaunchProfile lp)
            {
                return(lp);
            }

            // Unknown implementation. Make a defensive copy to a new immutable instance.
            return(new LaunchProfile(
                       name: profile.Name,
                       executablePath: profile.ExecutablePath,
                       commandName: profile.CommandName,
                       commandLineArgs: profile.CommandLineArgs,
                       workingDirectory: profile.WorkingDirectory,
                       launchBrowser: profile.LaunchBrowser,
                       launchUrl: profile.LaunchUrl,
                       environmentVariables: profile.FlattenEnvironmentVariables(),
                       otherSettings: profile.FlattenOtherSettings(),
                       doNotPersist: profile.IsInMemoryObject()));
        }