Team Ai
Datasetpublic

MegaBites-AI/Windows-powershell

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes308downloads
ParameterBinderExceptions.cs1032 linesDownload Raw Back to utils
1// Copyright (c) Microsoft Corporation.2// Licensed under the MIT License.3 4using System.Management.Automation.Internal;5using System.Management.Automation.Language;6using System.Runtime.Serialization;7 8namespace System.Management.Automation9{10    /// <summary>11    /// The exception thrown if the specified value can not be bound parameter of a command.12    /// </summary>13    public class ParameterBindingException : RuntimeException14    {15        #region Constructors16 17        #region Preferred constructors18 19        /// <summary>20        /// Constructs a ParameterBindingException.21        /// </summary>22        /// <param name="errorCategory">23        /// The category for the error.24        /// </param>25        /// <param name="invocationInfo">26        /// The information about the command that encountered the error.27        /// <!--28        /// InvocationInfo.MyCommand.Name == {0}29        /// -->30        /// </param>31        /// <param name="errorPosition">32        /// The position for the command or parameter that caused the error.33        /// If position is null, the one from the InvocationInfo is used.34        /// <!--35        /// token.LineNumber == {4}36        /// token.OffsetInLine == {5}37        /// -->38        /// </param>39        /// <param name="parameterName">40        /// The parameter on which binding caused the error.41        /// <!--42        /// parameterName == {1}43        /// -->44        /// </param>45        /// <param name="parameterType">46        /// The Type the parameter was expecting.47        /// <!--48        /// parameterType == {2}49        /// -->50        /// </param>51        /// <param name="typeSpecified">52        /// The Type that was attempted to be bound to the parameter.53        /// <!--54        /// typeSpecified == {3}55        /// -->56        /// </param>57        /// <param name="resourceString">58        /// The format string for the exception message.59        /// </param>60        /// <param name="errorId">61        /// The error ID.62        /// </param>63        /// <param name="args">64        /// Additional arguments to pass to the format string.65        /// <!--66        /// starts at {6}67        /// -->68        /// </param>69        /// <exception cref="ArgumentException">70        /// If <paramref name="resourceString"/> or <paramref name="errorId"/>71        /// is null or empty.72        /// </exception>73        internal ParameterBindingException(74            ErrorCategory errorCategory,75            InvocationInfo invocationInfo,76            IScriptExtent errorPosition,77            string parameterName,78            Type parameterType,79            Type typeSpecified,80            string resourceString,81            string errorId,82            params object[] args)83            : base(errorCategory, invocationInfo, errorPosition, errorId, null, null)84        {85            if (string.IsNullOrEmpty(resourceString))86            {87                throw PSTraceSource.NewArgumentException(nameof(resourceString));88            }89 90            if (string.IsNullOrEmpty(errorId))91            {92                throw PSTraceSource.NewArgumentException(nameof(errorId));93            }94 95            _invocationInfo = invocationInfo;96 97            if (_invocationInfo != null)98            {99                _commandName = invocationInfo.MyCommand.Name;100            }101 102            _parameterName = parameterName;103            _parameterType = parameterType;104            _typeSpecified = typeSpecified;105 106            if ((errorPosition == null) && (_invocationInfo != null))107            {108                errorPosition = invocationInfo.ScriptPosition;109            }110 111            if (errorPosition != null)112            {113                _line = errorPosition.StartLineNumber;114                _offset = errorPosition.StartColumnNumber;115            }116 117            _resourceString = resourceString;118            _errorId = errorId;119 120            if (args != null)121            {122                _args = args;123            }124        }125 126        /// <summary>127        /// Constructs a ParameterBindingException.128        /// </summary>129        /// <param name="innerException">130        /// The inner exception.131        /// </param>132        /// <param name="errorCategory">133        /// The category for the error.134        /// </param>135        /// <param name="invocationInfo">136        /// The information about the command that encountered the error.137        ///138        /// InvocationInfo.MyCommand.Name == {0}139        /// </param>140        /// <param name="errorPosition">141        /// The position for the command or parameter that caused the error.142        /// If position is null, the one from the InvocationInfo is used.143        ///144        /// token.LineNumber == {4}145        /// token.OffsetInLine == {5}146        /// </param>147        /// <param name="parameterName">148        /// The parameter on which binding caused the error.149        ///150        /// parameterName == {1}151        /// </param>152        /// <param name="parameterType">153        /// The Type the parameter was expecting.154        ///155        /// parameterType == {2}156        /// </param>157        /// <param name="typeSpecified">158        /// The Type that was attempted to be bound to the parameter.159        ///160        /// typeSpecified == {3}161        /// </param>162        /// <param name="resourceString">163        /// The format string for the exception message.164        /// </param>165        /// <param name="errorId">166        /// The error ID.167        /// </param>168        /// <param name="args">169        /// Additional arguments to pass to the format string.170        ///171        /// starts at {6}172        /// </param>173        /// <exception cref="ArgumentNullException">174        /// If <paramref name="invocationInfo"/> is null.175        /// </exception>176        /// <exception cref="ArgumentException">177        /// If <paramref name="resourceString"/> or <paramref name="errorId"/>178        /// is null or empty.179        /// </exception>180        internal ParameterBindingException(181            Exception innerException,182            ErrorCategory errorCategory,183            InvocationInfo invocationInfo,184            IScriptExtent errorPosition,185            string parameterName,186            Type parameterType,187            Type typeSpecified,188            string resourceString,189            string errorId,190            params object[] args)191            : base(errorCategory, invocationInfo, errorPosition, errorId, null, innerException)192        {193            if (invocationInfo == null)194            {195                throw PSTraceSource.NewArgumentNullException(nameof(invocationInfo));196            }197 198            if (string.IsNullOrEmpty(resourceString))199            {200                throw PSTraceSource.NewArgumentException(nameof(resourceString));201            }202 203            if (string.IsNullOrEmpty(errorId))204            {205                throw PSTraceSource.NewArgumentException(nameof(errorId));206            }207 208            _invocationInfo = invocationInfo;209            _commandName = invocationInfo.MyCommand.Name;210            _parameterName = parameterName;211            _parameterType = parameterType;212            _typeSpecified = typeSpecified;213 214            errorPosition ??= invocationInfo.ScriptPosition;215 216            if (errorPosition != null)217            {218                _line = errorPosition.StartLineNumber;219                _offset = errorPosition.StartColumnNumber;220            }221 222            _resourceString = resourceString;223            _errorId = errorId;224 225            if (args != null)226            {227                _args = args;228            }229        }230 231        /// <summary>232        /// </summary>233        /// <param name="innerException"></param>234        /// <param name="pbex"></param>235        /// <param name="resourceString"></param>236        /// <param name="args"></param>237        internal ParameterBindingException(238            Exception innerException,239            ParameterBindingException pbex,240            string resourceString,241            params object[] args)242            : base(string.Empty, innerException)243        {244            if (pbex == null)245            {246                throw PSTraceSource.NewArgumentNullException(nameof(pbex));247            }248 249            if (string.IsNullOrEmpty(resourceString))250            {251                throw PSTraceSource.NewArgumentException(nameof(resourceString));252            }253 254            _invocationInfo = pbex.CommandInvocation;255            if (_invocationInfo != null)256            {257                _commandName = _invocationInfo.MyCommand.Name;258            }259 260            IScriptExtent errorPosition = null;261            if (_invocationInfo != null)262            {263                errorPosition = _invocationInfo.ScriptPosition;264            }265 266            _line = pbex.Line;267            _offset = pbex.Offset;268 269            _parameterName = pbex.ParameterName;270            _parameterType = pbex.ParameterType;271            _typeSpecified = pbex.TypeSpecified;272            _errorId = pbex.ErrorId;273 274            _resourceString = resourceString;275 276            if (args != null)277            {278                _args = args;279            }280 281            base.SetErrorCategory(pbex.ErrorRecord._category);282            base.SetErrorId(_errorId);283            if (_invocationInfo != null)284            {285                base.ErrorRecord.SetInvocationInfo(new InvocationInfo(_invocationInfo.MyCommand, errorPosition));286            }287        }288        #endregion Preferred constructors289 290        #region serialization291        /// <summary>292        /// Constructors a ParameterBindingException using serialized data.293        /// </summary>294        /// <param name="info">295        /// serialization information296        /// </param>297        /// <param name="context">298        /// streaming context299        /// </param>300        [Obsolete("Legacy serialization support is deprecated since .NET 8", DiagnosticId = "SYSLIB0051")]301        protected ParameterBindingException(302            SerializationInfo info,303            StreamingContext context)304        {305            throw new NotSupportedException();306        }307        #endregion serialization308 309        #region Do Not Use310 311        /// <summary>312        /// Constructs a ParameterBindingException.313        /// </summary>314        /// <remarks>315        /// DO NOT USE!!!316        /// </remarks>317        public ParameterBindingException() : base() { }318 319        /// <summary>320        /// Constructors a ParameterBindingException.321        /// </summary>322        /// <param name="message">323        /// Message to be included in exception.324        /// </param>325        /// <remarks>326        /// DO NOT USE!!!327        /// </remarks>328        public ParameterBindingException(string message) : base(message) { _message = message; }329 330        /// <summary>331        /// Constructs a ParameterBindingException.332        /// </summary>333        /// <param name="message">334        /// Message to be included in the exception.335        /// </param>336        /// <param name="innerException">337        /// exception that led to this exception338        /// </param>339        /// <remarks>340        /// DO NOT USE!!!341        /// </remarks>342        public ParameterBindingException(343            string message,344            Exception innerException)345            : base(message, innerException)346        { _message = message; }347 348        #endregion Do Not Use349        #endregion Constructors350 351        #region Properties352        /// <summary>353        /// Gets the message for the exception.354        /// </summary>355        public override string Message356        {357            get { return _message ??= BuildMessage(); }358        }359 360        private string _message;361 362        /// <summary>363        /// Gets the name of the parameter that the parameter binding364        /// error was encountered on.365        /// </summary>366        public string ParameterName367        {368            get369            {370                return _parameterName;371            }372        }373 374        private readonly string _parameterName = string.Empty;375 376        /// <summary>377        /// Gets the type the parameter is expecting.378        /// </summary>379        public Type ParameterType380        {381            get382            {383                return _parameterType;384            }385        }386 387        private readonly Type _parameterType;388 389        /// <summary>390        /// Gets the Type that was specified as the parameter value.391        /// </summary>392        public Type TypeSpecified393        {394            get395            {396                return _typeSpecified;397            }398        }399 400        private readonly Type _typeSpecified;401 402        /// <summary>403        /// Gets the errorId of this ParameterBindingException.404        /// </summary>405        public string ErrorId406        {407            get408            {409                return _errorId;410            }411        }412 413        private readonly string _errorId;414 415        /// <summary>416        /// Gets the line in the script at which the error occurred.417        /// </summary>418        public Int64 Line419        {420            get421            {422                return _line;423            }424        }425 426        private readonly Int64 _line = Int64.MinValue;427 428        /// <summary>429        /// Gets the offset on the line in the script at which the error occurred.430        /// </summary>431        public Int64 Offset432        {433            get434            {435                return _offset;436            }437        }438 439        private readonly Int64 _offset = Int64.MinValue;440 441        /// <summary>442        /// Gets the invocation information about the command.443        /// </summary>444        public InvocationInfo CommandInvocation445        {446            get447            {448                return _invocationInfo;449            }450        }451 452        private readonly InvocationInfo _invocationInfo;453        #endregion Properties454 455        #region private456 457        private readonly string _resourceString;458        private readonly object[] _args = Array.Empty<object>();459        private readonly string _commandName;460 461        private string BuildMessage()462        {463            object[] messageArgs = Array.Empty<object>();464 465            if (_args != null)466            {467                messageArgs = new object[_args.Length + 6];468                messageArgs[0] = _commandName;469                messageArgs[1] = _parameterName;470                messageArgs[2] = _parameterType;471                messageArgs[3] = _typeSpecified;472                messageArgs[4] = _line;473                messageArgs[5] = _offset;474                _args.CopyTo(messageArgs, 6);475            }476 477            string result = string.Empty;478 479            if (!string.IsNullOrEmpty(_resourceString))480            {481                result = StringUtil.Format(_resourceString, messageArgs);482            }483 484            return result;485        }486 487        #endregion Private488    }489 490    internal class ParameterBindingValidationException : ParameterBindingException491    {492        #region Preferred constructors493 494        /// <summary>495        /// Constructs a ParameterBindingValidationException.496        /// </summary>497        /// <param name="errorCategory">498        /// The category for the error.499        /// </param>500        /// <param name="invocationInfo">501        /// The information about the command that encountered the error.502        ///503        /// InvocationInfo.MyCommand.Name == {0}504        /// </param>505        /// <param name="errorPosition">506        /// The position for the command or parameter that caused the error.507        ///508        /// token.LineNumber == {4}509        /// token.OffsetInLine == {5}510        /// </param>511        /// <param name="parameterName">512        /// The parameter on which binding caused the error.513        ///514        /// parameterName == {1}515        /// </param>516        /// <param name="parameterType">517        /// The Type the parameter was expecting.518        ///519        /// parameterType == {2}520        /// </param>521        /// <param name="typeSpecified">522        /// The Type that was attempted to be bound to the parameter.523        ///524        /// typeSpecified == {3}525        /// </param>526        /// <param name="resourceString">527        /// The format string for the exception message.528        /// </param>529        /// <param name="errorId">530        /// The error ID.531        /// </param>532        /// <param name="args">533        /// Additional arguments to pass to the format string.534        ///535        /// starts at {6}536        /// </param>537        /// <exception cref="ArgumentException">538        /// If <paramref name="resourceString"/> or <paramref name="errorId"/>539        /// is null or empty.540        /// </exception>541        internal ParameterBindingValidationException(542            ErrorCategory errorCategory,543            InvocationInfo invocationInfo,544            IScriptExtent errorPosition,545            string parameterName,546            Type parameterType,547            Type typeSpecified,548            string resourceString,549            string errorId,550            params object[] args)551            : base(552                errorCategory,553                invocationInfo,554                errorPosition,555                parameterName,556                parameterType,557                typeSpecified,558                resourceString,559                errorId,560                args)561        {562        }563 564        /// <summary>565        /// Constructs a ParameterBindingValidationException.566        /// </summary>567        /// <param name="innerException">568        /// The inner exception.569        /// </param>570        /// <param name="errorCategory">571        /// The category for the error.572        /// </param>573        /// <param name="invocationInfo">574        /// The information about the command that encountered the error.575        ///576        /// InvocationInfo.MyCommand.Name == {0}577        /// </param>578        /// <param name="errorPosition">579        /// The position for the command or parameter that caused the error.580        ///581        /// token.LineNumber == {4}582        /// token.OffsetInLine == {5}583        /// </param>584        /// <param name="parameterName">585        /// The parameter on which binding caused the error.586        ///587        /// parameterName == {1}588        /// </param>589        /// <param name="parameterType">590        /// The Type the parameter was expecting.591        ///592        /// parameterType == {2}593        /// </param>594        /// <param name="typeSpecified">595        /// The Type that was attempted to be bound to the parameter.596        ///597        /// typeSpecified == {3}598        /// </param>599        /// <param name="resourceString">600        /// The format string for the exception message.601        /// </param>602        /// <param name="errorId">603        /// The error ID.604        /// </param>605        /// <param name="args">606        /// Additional arguments to pass to the format string.607        ///608        /// starts at {6}609        /// </param>610        /// <exception cref="ArgumentNullException">611        /// If <paramref name="invocationInfo"/> is null.612        /// </exception>613        /// <exception cref="ArgumentException">614        /// If <paramref name="resourceBaseName"/> or <paramref name="errorIdAndResourceId"/>615        /// is null or empty.616        /// </exception>617        internal ParameterBindingValidationException(618            Exception innerException,619            ErrorCategory errorCategory,620            InvocationInfo invocationInfo,621            IScriptExtent errorPosition,622            string parameterName,623            Type parameterType,624            Type typeSpecified,625            string resourceString,626            string errorId,627            params object[] args)628            : base(629                innerException,630                errorCategory,631                invocationInfo,632                errorPosition,633                parameterName,634                parameterType,635                typeSpecified,636                resourceString,637                errorId,638                args)639        {640            if (innerException is ValidationMetadataException validationException && validationException.SwallowException)641            {642                _swallowException = true;643            }644        }645        #endregion Preferred constructors646 647        #region serialization648        /// <summary>649        /// Constructs a ParameterBindingValidationException from serialized data.650        /// </summary>651        /// <param name="info">652        /// serialization information653        /// </param>654        /// <param name="context">655        /// streaming context656        /// </param>657        [Obsolete("Legacy serialization support is deprecated since .NET 8", DiagnosticId = "SYSLIB0051")]658        protected ParameterBindingValidationException(659            SerializationInfo info,660            StreamingContext context)661        {662            throw new NotSupportedException();663        }664 665        #endregion serialization666 667        #region Property668 669        /// <summary>670        /// Make the positional binding ignore this validation exception when it's set to true.671        /// </summary>672        /// <remarks>673        /// This property is only used internally in the positional binding phase674        /// </remarks>675        internal bool SwallowException676        {677            get { return _swallowException; }678        }679 680        private readonly bool _swallowException = false;681 682        #endregion Property683    }684 685    internal class ParameterBindingArgumentTransformationException : ParameterBindingException686    {687        #region Preferred constructors688 689        /// <summary>690        /// Constructs a ParameterBindingArgumentTransformationException.691        /// </summary>692        /// <param name="errorCategory">693        /// The category for the error.694        /// </param>695        /// <param name="invocationInfo">696        /// The information about the command that encountered the error.697        ///698        /// InvocationInfo.MyCommand.Name == {0}699        /// </param>700        /// <param name="errorPosition">701        /// The position for the command or parameter that caused the error.702        ///703        /// token.LineNumber == {4}704        /// token.OffsetInLine == {5}705        /// </param>706        /// <param name="parameterName">707        /// The parameter on which binding caused the error.708        ///709        /// parameterName == {1}710        /// </param>711        /// <param name="parameterType">712        /// The Type the parameter was expecting.713        ///714        /// parameterType == {2}715        /// </param>716        /// <param name="typeSpecified">717        /// The Type that was attempted to be bound to the parameter.718        ///719        /// typeSpecified == {3}720        /// </param>721        /// <param name="resourceString">722        /// The format string for the exception message.723        /// </param>724        /// <param name="errorId">725        /// The error ID.726        /// </param>727        /// <param name="args">728        /// Additional arguments to pass to the format string.729        ///730        /// starts at {6}731        /// </param>732        /// <exception cref="ArgumentException">733        /// If <paramref name="resourceString"/> or <paramref name="errorId"/>734        /// is null or empty.735        /// </exception>736        internal ParameterBindingArgumentTransformationException(737            ErrorCategory errorCategory,738            InvocationInfo invocationInfo,739            IScriptExtent errorPosition,740            string parameterName,741            Type parameterType,742            Type typeSpecified,743            string resourceString,744            string errorId,745            params object[] args)746            : base(747                errorCategory,748                invocationInfo,749                errorPosition,750                parameterName,751                parameterType,752                typeSpecified,753                resourceString,754                errorId,755                args)756        {757        }758 759        /// <summary>760        /// Constructs a ParameterBindingArgumentTransformationException.761        /// </summary>762        /// <param name="innerException">763        /// The inner exception.764        /// </param>765        /// <param name="errorCategory">766        /// The category for the error.767        /// </param>768        /// <param name="invocationInfo">769        /// The information about the command that encountered the error.770        ///771        /// InvocationInfo.MyCommand.Name == {0}772        /// </param>773        /// <param name="errorPosition">774        /// The position for the command or parameter that caused the error.775        ///776        /// token.LineNumber == {4}777        /// token.OffsetInLine == {5}778        /// </param>779        /// <param name="parameterName">780        /// The parameter on which binding caused the error.781        ///782        /// parameterName == {1}783        /// </param>784        /// <param name="parameterType">785        /// The Type the parameter was expecting.786        ///787        /// parameterType == {2}788        /// </param>789        /// <param name="typeSpecified">790        /// The Type that was attempted to be bound to the parameter.791        ///792        /// typeSpecified == {3}793        /// </param>794        /// <param name="resourceString">795        /// The format string for the exception message.796        /// </param>797        /// <param name="errorId">798        /// The error ID.799        /// </param>800        /// <param name="args">801        /// Additional arguments to pass to the format string.802        ///803        /// starts at {6}804        /// </param>805        /// <exception cref="ArgumentNullException">806        /// If <paramref name="invocationInfo"/> is null.807        /// </exception>808        /// <exception cref="ArgumentException">809        /// If <paramref name="resourceString"/> or <paramref name="errorId"/>810        /// is null or empty.811        /// </exception>812        internal ParameterBindingArgumentTransformationException(813            Exception innerException,814            ErrorCategory errorCategory,815            InvocationInfo invocationInfo,816            IScriptExtent errorPosition,817            string parameterName,818            Type parameterType,819            Type typeSpecified,820            string resourceString,821            string errorId,822            params object[] args)823            : base(824                innerException,825                errorCategory,826                invocationInfo,827                errorPosition,828                parameterName,829                parameterType,830                typeSpecified,831                resourceString,832                errorId,833                args)834        {835        }836        #endregion Preferred constructors837        #region serialization838        /// <summary>839        /// Constructs a ParameterBindingArgumentTransformationException using serialized data.840        /// </summary>841        /// <param name="info">842        /// serialization information843        /// </param>844        /// <param name="context">845        /// streaming context846        /// </param>847        [Obsolete("Legacy serialization support is deprecated since .NET 8", DiagnosticId = "SYSLIB0051")]848        protected ParameterBindingArgumentTransformationException(849            SerializationInfo info,850            StreamingContext context)851        {852            throw new NotSupportedException();853        }854 855        #endregion serialization856    }857 858    internal class ParameterBindingParameterDefaultValueException : ParameterBindingException859    {860        #region Preferred constructors861 862        /// <summary>863        /// Constructs a ParameterBindingParameterDefaultValueException.864        /// </summary>865        /// <param name="errorCategory">866        /// The category for the error.867        /// </param>868        /// <param name="invocationInfo">869        /// The information about the command that encountered the error.870        ///871        /// InvocationInfo.MyCommand.Name == {0}872        /// </param>873        /// <param name="errorPosition">874        /// The position for the command or parameter that caused the error.875        ///876        /// token.LineNumber == {4}877        /// token.OffsetInLine == {5}878        /// </param>879        /// <param name="parameterName">880        /// The parameter on which binding caused the error.881        ///882        /// parameterName == {1}883        /// </param>884        /// <param name="parameterType">885        /// The Type the parameter was expecting.886        ///887        /// parameterType == {2}888        /// </param>889        /// <param name="typeSpecified">890        /// The Type that was attempted to be bound to the parameter.891        ///892        /// typeSpecified == {3}893        /// </param>894        /// <param name="resourceString">895        /// The format string for the exception message.896        /// </param>897        /// <param name="errorId">898        /// The error ID.899        /// </param>900        /// <param name="args">901        /// Additional arguments to pass to the format string.902        ///903        /// starts at {6}904        /// </param>905        /// <exception cref="ArgumentException">906        /// If <paramref name="resourceString"/> or <paramref name="errorId"/>907        /// is null or empty.908        /// </exception>909        internal ParameterBindingParameterDefaultValueException(910            ErrorCategory errorCategory,911            InvocationInfo invocationInfo,912            IScriptExtent errorPosition,913            string parameterName,914            Type parameterType,915            Type typeSpecified,916            string resourceString,917            string errorId,918            params object[] args)919            : base(920                errorCategory,921                invocationInfo,922                errorPosition,923                parameterName,924                parameterType,925                typeSpecified,926                resourceString,927                errorId,928                args)929        {930        }931 932        /// <summary>933        /// Constructs a ParameterBindingParameterDefaultValueException.934        /// </summary>935        /// <param name="innerException">936        /// The inner exception.937        /// </param>938        /// <param name="errorCategory">939        /// The category for the error.940        /// </param>941        /// <param name="invocationInfo">942        /// The information about the command that encountered the error.943        ///944        /// InvocationInfo.MyCommand.Name == {0}945        /// </param>946        /// <param name="errorPosition">947        /// The position for the command or parameter that caused the error.948        ///949        /// token.LineNumber == {4}950        /// token.OffsetInLine == {5}951        /// </param>952        /// <param name="parameterName">953        /// The parameter on which binding caused the error.954        ///955        /// parameterName == {1}956        /// </param>957        /// <param name="parameterType">958        /// The Type the parameter was expecting.959        ///960        /// parameterType == {2}961        /// </param>962        /// <param name="typeSpecified">963        /// The Type that was attempted to be bound to the parameter.964        ///965        /// typeSpecified == {3}966        /// </param>967        /// <param name="resourceString">968        /// The format string for the exception message.969        /// </param>970        /// <param name="errorId">971        /// The error ID.972        /// </param>973        /// <param name="args">974        /// Additional arguments to pass to the format string.975        ///976        /// starts at {6}977        /// </param>978        /// <exception cref="ArgumentNullException">979        /// If <paramref name="invocationInfo"/> is null.980        /// </exception>981        /// <exception cref="ArgumentException">982        /// If <paramref name="resourceString"/> or <paramref name="errorId"/>983        /// is null or empty.984        /// </exception>985        internal ParameterBindingParameterDefaultValueException(986            Exception innerException,987            ErrorCategory errorCategory,988            InvocationInfo invocationInfo,989            IScriptExtent errorPosition,990            string parameterName,991            Type parameterType,992            Type typeSpecified,993            string resourceString,994            string errorId,995            params object[] args)996            : base(997                innerException,998                errorCategory,999                invocationInfo,1000                errorPosition,1001                parameterName,1002                parameterType,1003                typeSpecified,1004                resourceString,1005                errorId,1006                args)1007        {1008        }1009        #endregion Preferred constructors1010 1011        #region serialization1012        /// <summary>1013        /// Constructs a ParameterBindingParameterDefaultValueException using serialized data.1014        /// </summary>1015        /// <param name="info">1016        /// serialization information1017        /// </param>1018        /// <param name="context">1019        /// streaming context1020        /// </param>1021        [Obsolete("Legacy serialization support is deprecated since .NET 8", DiagnosticId = "SYSLIB0051")]1022        protected ParameterBindingParameterDefaultValueException(1023            SerializationInfo info,1024            StreamingContext context)1025        {1026            throw new NotSupportedException();1027        }1028 1029        #endregion serialization1030    }1031}1032