/// <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.CanBeRetriedInlineOrFalseIfNull() || retryInfo.RetryReason != RetryReason.ResourceExhaustion);
            Contract.Requires(!retryInfo.CanBeRetriedInlineOrFalseIfNull() || retryInfo.RetryReason != RetryReason.ProcessStartFailure);
            Contract.Requires(!retryInfo.CanBeRetriedInlineOrFalseIfNull() || retryInfo.RetryReason != RetryReason.TempDirectoryCleanupFailure);
            Contract.Requires(!retryInfo.CanBeRetriedInlineOrFalseIfNull() || 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>();
        }
示例#2
0
        /// <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 numberOfProcessLaunchRetries,
            int exitCode,
            long sandboxPrepMs,
            long processSandboxedProcessResultMs,
            long processStartTime,
            IReadOnlyList<ReportedFileAccess> allReportedFileAccesses,
            IReadOnlyList<ProcessDetouringStatusData> detouringStatuses,
            long maxDetoursHeapSize,
            ContainerConfiguration containerConfiguration,
            Dictionary<string, int> pipProperties,
            bool timedOut,
            CancellationReason cancellationReason = CancellationReason.None)
        {
            Contract.Requires(
                (status == SandboxedProcessPipExecutionStatus.PreparationFailed ||
                status == SandboxedProcessPipExecutionStatus.ShouldBeRetriedDueToUserSpecifiedExitCode ||
                status == SandboxedProcessPipExecutionStatus.Canceled) ||
                observedFileAccesses.IsValid);
            Contract.Requires(
                (status == SandboxedProcessPipExecutionStatus.PreparationFailed || status == SandboxedProcessPipExecutionStatus.ShouldBeRetriedDueToUserSpecifiedExitCode ||
                status == SandboxedProcessPipExecutionStatus.Canceled) ||
                unexpectedFileAccesses != null);
            Contract.Requires((status == SandboxedProcessPipExecutionStatus.PreparationFailed || status == SandboxedProcessPipExecutionStatus.Canceled) || 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);

            Status = status;
            ObservedFileAccesses = observedFileAccesses;
            UnexpectedFileAccesses = unexpectedFileAccesses;
            EncodedStandardOutput = encodedStandardOutput;
            EncodedStandardError = encodedStandardError;
            NumberOfWarnings = numberOfWarnings;
            PrimaryProcessTimes = primaryProcessTimes;
            JobAccountingInformation = jobAccountingInformation;
            NumberOfProcessLaunchRetries = numberOfProcessLaunchRetries;
            ExitCode = exitCode;
            SandboxPrepMs = sandboxPrepMs;
            ProcessSandboxedProcessResultMs = processSandboxedProcessResultMs;
            ProcessStartTimeMs = processStartTime;
            AllReportedFileAccesses = allReportedFileAccesses;
            DetouringStatuses = detouringStatuses;
            MaxDetoursHeapSizeInBytes = maxDetoursHeapSize;
            SharedDynamicDirectoryWriteAccesses = sharedDynamicDirectoryWriteAccesses;
            ContainerConfiguration = containerConfiguration;
            PipProperties = pipProperties;
            TimedOut = timedOut;
            CancellationReason = cancellationReason;
        }