コード例 #1
0
        public async Task <string> FindFileAsync(
            string filename, BuildId uuid, bool isDebugInfoFile, TextWriter searchLog)
        {
            if (string.IsNullOrEmpty(filename))
            {
                throw new ArgumentNullException(Strings.FilenameNullOrEmpty, nameof(filename));
            }
            searchLog = searchLog ?? TextWriter.Null;

            await searchLog.WriteLineAsync($"Searching for {filename}");

            Trace.WriteLine($"Searching for {filename}");

            if (uuid == BuildId.Empty)
            {
                await searchLog.WriteLineAsync(ErrorStrings.ModuleBuildIdUnknown);

                Trace.WriteLine($"Warning: The build ID of {filename} is unknown.");
            }

            var fileReference =
                await _symbolStore.FindFileAsync(filename, uuid, isDebugInfoFile, searchLog);

            if (fileReference == null)
            {
                await searchLog.WriteLineAsync(ErrorStrings.FailedToFindFile(filename));

                Trace.WriteLine(ErrorStrings.FailedToFindFile(filename));
                return(null);
            }
            if (!fileReference.IsFilesystemLocation)
            {
                await searchLog.WriteLineAsync(
                    ErrorStrings.FileNotOnFilesystem(fileReference.Location));

                Trace.WriteLine($"Unable to load file. '{fileReference.Location}' must be " +
                                $"cached in a filesystem location.");
                return(null);
            }

            return(fileReference.Location);
        }