/// <nodoc /> public SandboxedProcessPipExecutionResult( SandboxedProcessPipExecutionStatus status, SortedReadOnlyArray <ObservedFileAccess, ObservedFileAccessExpandedPathComparer> observedFileAccesses, IReadOnlyDictionary <AbsolutePath, IReadOnlyCollection <FileArtifactWithAttributes> > sharedDynamicDirectoryWriteAccesses, Tuple <AbsolutePath, Encoding> encodedStandardOutput, Tuple <AbsolutePath, Encoding> encodedStandardError, int numberOfWarnings, FileAccessReportingContext unexpectedFileAccesses, ProcessTimes primaryProcessTimes, JobObject.AccountingInformation?jobAccountingInformation, int exitCode, long sandboxPrepMs, long processSandboxedProcessResultMs, long processStartTime, IReadOnlyList <ReportedFileAccess> allReportedFileAccesses, IReadOnlyList <ProcessDetouringStatusData> detouringStatuses, long maxDetoursHeapSize, ContainerConfiguration containerConfiguration, Dictionary <string, int> pipProperties, bool timedOut, IReadOnlySet <AbsolutePath> createdDirectories, RetryInfo retryInfo = null) { Contract.Requires(!ProcessCompletedExecution(status) || observedFileAccesses.IsValid); Contract.Requires(!ProcessCompletedExecution(status) || unexpectedFileAccesses != null); Contract.Requires(!ProcessCompletedExecution(status) || primaryProcessTimes != null); Contract.Requires(encodedStandardOutput == null || (encodedStandardOutput.Item1.IsValid && encodedStandardOutput.Item2 != null)); Contract.Requires(encodedStandardError == null || (encodedStandardError.Item1.IsValid && encodedStandardError.Item2 != null)); Contract.Requires(numberOfWarnings >= 0); Contract.Requires(containerConfiguration != null); Contract.Requires(retryInfo == null || status != SandboxedProcessPipExecutionStatus.Succeeded); // Protect against invalid combinations of RetryLocation and RetryReason Contract.Requires(!RetryInfo.RetryAbleOnSameWorker(retryInfo) || retryInfo.RetryReason != RetryReason.ResourceExhaustion); Contract.Requires(!RetryInfo.RetryAbleOnSameWorker(retryInfo) || retryInfo.RetryReason != RetryReason.ProcessStartFailure); Contract.Requires(!RetryInfo.RetryAbleOnSameWorker(retryInfo) || retryInfo.RetryReason != RetryReason.TempDirectoryCleanupFailure); Contract.Requires(!RetryInfo.RetryAbleOnSameWorker(retryInfo) || retryInfo.RetryReason != RetryReason.StoppedWorker); Status = status; ObservedFileAccesses = observedFileAccesses; UnexpectedFileAccesses = unexpectedFileAccesses; EncodedStandardOutput = encodedStandardOutput; EncodedStandardError = encodedStandardError; NumberOfWarnings = numberOfWarnings; PrimaryProcessTimes = primaryProcessTimes; JobAccountingInformation = jobAccountingInformation; ExitCode = exitCode; SandboxPrepMs = sandboxPrepMs; ProcessSandboxedProcessResultMs = processSandboxedProcessResultMs; ProcessStartTimeMs = processStartTime; AllReportedFileAccesses = allReportedFileAccesses; DetouringStatuses = detouringStatuses; MaxDetoursHeapSizeInBytes = maxDetoursHeapSize; SharedDynamicDirectoryWriteAccesses = sharedDynamicDirectoryWriteAccesses; ContainerConfiguration = containerConfiguration; PipProperties = pipProperties; TimedOut = timedOut; RetryInfo = retryInfo; CreatedDirectories = createdDirectories ?? CollectionUtilities.EmptySet <AbsolutePath>(); }
/// <summary> /// Returns true if retry location is <see cref="RetryLocation.SameWorker"/> or <see cref="RetryLocation.Both"/> after a null check /// </summary> public static bool RetryAbleOnSameWorker(RetryInfo retryInfo) => retryInfo?.RetryAbleOnSameWorker() ?? false;