public override async Task <IFileReference> FindFileAsync(string filename, BuildId buildId, bool isDebugInfoFile, TextWriter log) { if (string.IsNullOrEmpty(filename)) { throw new ArgumentException(Strings.FilenameNullOrEmpty, nameof(filename)); } if (buildId == BuildId.Empty) { // TODO: simplify logging Trace.WriteLine(Strings.FailedToSearchStadiaStore(filename, Strings.EmptyBuildId)); await log.WriteLineAsync( Strings.FailedToSearchStadiaStore(filename, Strings.EmptyBuildId)); return(null); } string fileUrl; try { // Ask backend for a download URL. This may throw RPC error NotFound, or return a // URL that does not exist. The second case is handled later. // TODO: figure out how to intercept these calls to record in metrics. fileUrl = await _crashReportClient.GenerateSymbolFileDownloadUrlAsync( buildId.ToHexString(), filename); } catch (CloudException e) { if (e.InnerException is RpcException inner && inner.StatusCode == StatusCode.NotFound) { // TODO: simplify logging Trace.WriteLine( Strings.FileNotFoundInStadiaStore(buildId.ToHexString(), filename)); await log.WriteLineAsync( Strings.FileNotFoundInStadiaStore(buildId.ToHexString(), filename)); }
// Just set the entire contents of the file to the bytes of the build ID public void WriteBuildId(string filepath, BuildId buildId) { fileSystem.Directory.CreateDirectory(Path.GetDirectoryName(filepath)); fileSystem.File.WriteAllText(filepath, buildId.ToHexString()); }
public void FromBytesToHexString(byte[] bytes, string str) { var buildId = new BuildId(bytes); Assert.AreEqual(str, buildId.ToHexString()); }