MegaBites-AI/Windows-powershell
0372
1// Copyright (c) Microsoft Corporation.2// Licensed under the MIT License.3 4using System.Runtime.Serialization;5 6namespace System.Management.Automation7{8 /// <summary>9 /// This is a wrapper for exception class10 /// <see cref="System.NotImplementedException"/>11 /// which provides additional information via12 /// <see cref="System.Management.Automation.IContainsErrorRecord"/>.13 /// </summary>14 /// <remarks>15 /// Instances of this exception class are usually generated by the16 /// PowerShell Engine. It is unusual for code outside the PowerShell Engine17 /// to create an instance of this class.18 /// </remarks>19 public class PSNotImplementedException20 : NotImplementedException, IContainsErrorRecord21 {22 #region ctor23 /// <summary>24 /// Initializes a new instance of the PSNotImplementedException class.25 /// </summary>26 /// <returns>Constructed object.</returns>27 public PSNotImplementedException()28 : base()29 {30 }31 32 #region Serialization33 /// <summary>34 /// Initializes a new instance of the PSNotImplementedException class35 /// using data serialized via36 /// <see cref="System.Runtime.Serialization.ISerializable"/>37 /// </summary>38 /// <param name="info">Serialization information.</param>39 /// <param name="context">Streaming context.</param>40 /// <returns>Constructed object.</returns>41 [Obsolete("Legacy serialization support is deprecated since .NET 8", DiagnosticId = "SYSLIB0051")]42 protected PSNotImplementedException(SerializationInfo info,43 StreamingContext context)44 {45 throw new NotSupportedException();46 }47 #endregion Serialization48 49 /// <summary>50 /// Initializes a new instance of the PSNotImplementedException class.51 /// </summary>52 /// <param name="message"></param>53 /// <returns>Constructed object.</returns>54 public PSNotImplementedException(string message)55 : base(message)56 {57 }58 59 /// <summary>60 /// Initializes a new instance of the PSNotImplementedException class.61 /// </summary>62 /// <param name="message"></param>63 /// <param name="innerException"></param>64 /// <returns>Constructed object.</returns>65 public PSNotImplementedException(string message,66 Exception innerException)67 : base(message, innerException)68 {69 }70 #endregion ctor71 72 /// <summary>73 /// Additional information about the error.74 /// </summary>75 /// <value></value>76 /// <remarks>77 /// Note that ErrorRecord.Exception is78 /// <see cref="System.Management.Automation.ParentContainsErrorRecordException"/>.79 /// </remarks>80 public ErrorRecord ErrorRecord81 {82 get83 {84 _errorRecord ??= new ErrorRecord(85 new ParentContainsErrorRecordException(this),86 _errorId,87 ErrorCategory.NotImplemented,88 null);89 90 return _errorRecord;91 }92 }93 94 private ErrorRecord _errorRecord;95 private readonly string _errorId = "NotImplemented";96 }97}98 