Repository: PowerShell/PowerShell
File: src/Microsoft.PowerShell.Commands.Management/commands/management/CombinePathCommand.cs (C#)

Code before:
        [AllowNull]
        [AllowEmptyString]
        [AllowEmptyCollection]
        public string[] AdditionalChildPath { get; set; } = Array.Empty<string>();

        /// <summary>
        /// Determines if the path should be resolved after being joined.
        /// </summary>
        /// <value></value>
        [Parameter]
        public SwitchParameter Resolve { get; set; }

        /// <summary>
        /// Gets or sets the extension to use for the resulting path.
        /// <para>
        /// Behavior:
        /// - If the path has an existing extension, it will be replaced with the specified extension.
        /// - If the path does not have an extension, the specified extension will be added.
        /// - If an empty string is provided, any existing extension will be removed.
        /// - A leading dot in the extension is optional; if omitted, one will be added automatically.
        /// </para>
        /// </summary>
        [Parameter(ValueFromPipelineByPropertyName = true)]
        public string Extension { get; set; }

        #endregion Parameters

        #region Command code

        /// <summary>
        /// Parses the specified path and returns the portion determined by the
        /// boolean parameters.
        /// </summary>
        protected override void ProcessRecord()
        {
            Dbg.Diagnostics.Assert(
                Path != null,
                "Since Path is a mandatory parameter, paths should never be null");

            string combinedChildPath = string.Empty;

            if (this.ChildPath != null)
            {
                foreach (string childPath in this.ChildPath)
                {
                    combinedChildPath = SessionState.Path.Combine(combinedChildPath, childPath, CmdletProviderContext);
                }
            }

            // join the ChildPath elements
            if (AdditionalChildPath != null)

Review comment (suggestion):
We need explicit `[ValidateNotNull]` to disable all null cases.

XML comment should be updated too.

Code after:
        [AllowNull]
        [AllowEmptyString]
        [AllowEmptyCollection]
        public string[] AdditionalChildPath { get; set; } = Array.Empty<string>();

        /// <summary>
        /// Determines if the path should be resolved after being joined.
        /// </summary>
        /// <value></value>
        [Parameter]
        public SwitchParameter Resolve { get; set; }

        /// <summary>
        /// Gets or sets the extension to use for the resulting path.
        /// If not specified, the original extension (if any) is preserved.
        /// <para>
        /// Behavior:
        /// - If the path has an existing extension, it will be replaced with the specified extension.
        /// - If the path does not have an extension, the specified extension will be added.
        /// - If an empty string is provided, any existing extension will be removed.
        /// - A leading dot in the extension is optional; if omitted, one will be added automatically.
        /// </para>
        /// </summary>
        [Parameter(ValueFromPipelineByPropertyName = true)]
        [ValidateNotNull]
        public string Extension { get; set; }

        #endregion Parameters

        #region Command code

        /// <summary>
        /// Parses the specified path and returns the portion determined by the
        /// boolean parameters.
        /// </summary>
        protected override void ProcessRecord()
        {
            Dbg.Diagnostics.Assert(
                Path != null,
                "Since Path is a mandatory parameter, paths should never be null");

            string combinedChildPath = string.Empty;

            if (this.ChildPath != null)
            {
                foreach (string childPath in this.ChildPath)
                {
                    combinedChildPath = SessionState.Path.Combine(combinedChildPath, childPath, CmdletProviderContext);
                }
            }