src/System.Management.Automation/engine/ExtendedTypeSystemException.cs
// InvalidCastException Has No Serialization In CoreCLR
/// <summary>
/// Populates a <see cref="System.Runtime.Serialization.SerializationInfo"/> with the
/// data needed to serialize the PSInvalidCastException object.
/// </summary>
/// <param name="info">The <see cref="System.Runtime.Serialization.SerializationInfo"/> to populate with data.</param>
/// <param name="context">The destination for this serialization.</param>
Populates a  with the
data needed to serialize the PSInvalidCastException object.
Populates a with the data needed to serialize the PSInvalidCastException object .
[SecurityPermissionAttribute(SecurityAction.Demand, SerializationFormatter = true)]
        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            if (info == null)
            {
                throw new PSArgumentNullException("info");
            }
            base.GetObjectData(info, context);
            info.AddValue("ErrorId", _errorId);
        }
[ SecurityPermissionAttribute ( SecurityAction . Demand , SerializationFormatter = true ) ] public override void GetObjectData ( SerializationInfo info , StreamingContext context ) { if ( info == null ) { throw new PSArgumentNullException ( " " ) ; } base . GetObjectData ( info , context ) ; info . AddValue ( " " , _errorId ) ; }
Populates a  with the
data needed to serialize the PSInvalidCastException object.
Populates a with the data needed to serialize the PSInvalidCastException object .
info
SerializationInfo
The  to populate with data.
The to populate with data .
context
StreamingContext
The destination for this serialization.
The destination for this serialization .