The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

IContainsErrorRecord.ErrorRecord Property


Updated: April 27, 2016

Applies To: Windows PowerShell

Gets the error record that describes the error that occurred.

Namespace:   System.Management.Automation
Assembly:  System.Management.Automation (in System.Management.Automation.dll)

ErrorRecord ErrorRecord { get; }

Property Value

Type: System.Management.Automation.ErrorRecord

Returns an ErrorRecord object that describes the error that occurred.

The error record retrieved by this property should contain a ParentContainsErrorRecordException object in the Exception property of the record rather than a reference to the root, or inner exception, of the record. This prevents a recursive reference between the exception implementing this interface and the error record returned by this property.

When implementing this property, use the ParentContainsErrorRecordException constructor when setting the Exception property of the error record to ensure that the ParentContainsErrorRecordException object has the same exception message as the root exception.

Return to top

Community Additions