internal static RemoteDataObject GenerateRunspacePoolStateInfo( Guid clientRunspacePoolId, RunspacePoolStateInfo stateInfo) { using (RemotingEncoder._trace.TraceMethod()) { PSObject emptyPsObject = RemotingEncoder.CreateEmptyPSObject(); PSNoteProperty psNoteProperty = new PSNoteProperty("RunspaceState", (object)(int)stateInfo.State); emptyPsObject.Properties.Add((PSPropertyInfo)psNoteProperty); if (stateInfo.Reason != null) { string errorId = "RemoteRunspaceStateInfoReason"; PSNoteProperty exceptionProperty = RemotingEncoder.GetExceptionProperty(stateInfo.Reason, errorId, ErrorCategory.NotSpecified); emptyPsObject.Properties.Add((PSPropertyInfo)exceptionProperty); } return(RemoteDataObject.CreateFrom(RemotingDestination.Client, RemotingDataType.RunspacePoolStateInfo, clientRunspacePoolId, Guid.Empty, (object)emptyPsObject)); } }