private static PSNoteProperty GetExceptionProperty( Exception exception, string errorId, ErrorCategory category) { using (RemotingEncoder._trace.TraceMethod()) return(new PSNoteProperty("ExceptionAsErrorRecord", (object)(RemotingEncoder.GetErrorRecordFromException(exception) ?? new ErrorRecord(exception, errorId, category, (object)null)))); }