/// <summary>
        /// Deserializes sandboxed process result from file.
        /// </summary>
        protected SandboxedProcessResult DeserializeSandboxedProcessResultFromFile()
        {
            string file = SandboxedProcessResultsFile;

            Func <BuildXLReader, AbsolutePath> readPath = reader =>
            {
                bool isAbsolutePath = reader.ReadBoolean();
                if (isAbsolutePath)
                {
                    return(reader.ReadAbsolutePath());
                }
                else
                {
                    string path = reader.ReadString();
                    return(AbsolutePath.Create(SandboxedProcessInfo.PathTable, path));
                }
            };

            try
            {
                using (FileStream stream = File.OpenRead(file))
                {
                    return(SandboxedProcessResult.Deserialize(stream, readPath));
                }
            }
            catch (IOException ioException)
            {
                ThrowBuildXLException($"Failed to deserialize sandboxed process result '{file}'", ioException);
                return(null);
            }
        }
Пример #2
0
        /// <summary>
        /// Deserializes sandboxed process result from file.
        /// </summary>
        /// <returns></returns>
        protected SandboxedProcessResult DeserializeSandboxedProcessResultFromFile()
        {
            string file = GetSandboxedProcessResultsFile();

            try
            {
                using (FileStream stream = File.OpenRead(file))
                {
                    return(SandboxedProcessResult.Deserialize(stream));
                }
            }
            catch (IOException ioException)
            {
                ThrowBuildXLException($"Failed to deserialize sandboxed process result '{file}'", ioException);
                return(null);
            }
        }