private static Task <ConcurrentBigMap <AbsolutePath, AbsolutePath> > LoadAsync(Stream stream, string fileName, PathTable pathTable)
        {
            return(ExceptionUtilities.HandleRecoverableIOException(
                       async() =>
            {
                s_fileEnvelope.ReadHeader(stream);
                using (BuildXLReader reader = new BuildXLReader(debug: false, stream: stream, leaveOpen: true))
                {
                    var stringTable = await StringTable.DeserializeAsync(reader);
                    var loadedPathTable = await PathTable.DeserializeAsync(reader, Task.FromResult(stringTable));

                    var importedPathIndex = pathTable.Import(loadedPathTable);

                    var pathMapping = new ConcurrentBigMap <AbsolutePath, AbsolutePath>();

                    var count = reader.ReadInt32();
                    for (int i = 0; i < count; i++)
                    {
                        var loadedKey = reader.ReadAbsolutePath();
                        var loadedValue = reader.ReadAbsolutePath();

                        var key = importedPathIndex[loadedKey.Value.Index];
                        var value = importedPathIndex[loadedValue.Value.Index];

                        pathMapping[key] = value;
                    }

                    return pathMapping;
                }
            },
                       ex => { throw new BuildXLException(I($"Failed to read '{fileName}'"), ex); }));
        }
        /// <summary>
        /// Reads a PathTable
        /// </summary>
        public async Task <PathTable> ReadPathTableAsync(Task <StringTable> stringTableTask)
        {
            Contract.Requires(stringTableTask != null);

            Start <PathTable>();
            var value = await PathTable.DeserializeAsync(this, stringTableTask);

            End();
            return(value);
        }