Esempio n. 1
0
        public IActionResult Report(string bundleId, string dumpId)
        {
            ViewData["Message"] = "Get Report";

            var bundleInfo = superDumpRepo.GetBundle(bundleId);

            if (bundleInfo == null)
            {
                return(View(null));
            }

            var dumpInfo = superDumpRepo.GetDump(bundleId, dumpId);

            if (dumpInfo == null)
            {
                return(View(null));
            }

            SDResult res = superDumpRepo.GetResult(bundleId, dumpId);

            return(base.View(new ReportViewModel(bundleId, dumpId)
            {
                BundleFileName = bundleInfo.BundleFileName,
                DumpFileName = dumpInfo.DumpFileName,
                Result = res,
                CustomProperties = Utility.Sanitize(bundleInfo.CustomProperties),
                HasAnalysisFailed = dumpInfo.Status == DumpStatus.Failed,
                TimeStamp = dumpInfo.Created,
                Files = dumpRepo.GetFileNames(bundleId, dumpId),
                AnalysisError = dumpInfo.ErrorMessage,
                ThreadTags = res != null ? res.GetThreadTags() : new HashSet <SDTag>(),
                PointerSize = res == null ? 8 : (res.SystemContext.ProcessArchitecture == "X86" ? 8 : 12),
                CustomTextResult = ReadCustomTextResult(dumpInfo)
            }));
        }
Esempio n. 2
0
        public async Task <IActionResult> Report(string bundleId, string dumpId)
        {
            ViewData["Message"] = "Get Report";

            var bundleInfo = superDumpRepo.GetBundle(bundleId);

            if (bundleInfo == null)
            {
                logger.LogNotFound("Report: Bundle not found", HttpContext, "BundleId", bundleId);
                return(View(null));
            }

            var dumpInfo = superDumpRepo.GetDump(bundleId, dumpId);

            if (dumpInfo == null)
            {
                logger.LogNotFound("Report: Dump not found", HttpContext, "DumpId", dumpId);
                return(View(null));
            }

            SDResult res = await superDumpRepo.GetResult(bundleId, dumpId);

            logger.LogDumpAccess("Report", HttpContext, bundleInfo, dumpId);

            return(base.View(new ReportViewModel(bundleId, dumpId)
            {
                BundleFileName = bundleInfo.BundleFileName,
                DumpFileName = dumpInfo.DumpFileName,
                Result = res,
                CustomProperties = Utility.Sanitize(bundleInfo.CustomProperties),
                HasAnalysisFailed = dumpInfo.Status == DumpStatus.Failed,
                TimeStamp = dumpInfo.Created,
                Files = dumpRepo.GetFileNames(bundleId, dumpId),
                AnalysisError = dumpInfo.ErrorMessage,
                ThreadTags = res != null ? res.GetThreadTags() : new HashSet <SDTag>(),
                PointerSize = res == null ? 8 : (res.SystemContext?.ProcessArchitecture == "X86" ? 8 : 12),
                CustomTextResult = await ReadCustomTextResult(dumpInfo),
                SDResultReadError = string.Empty,
                DumpType = dumpInfo.DumpType,
                RepositoryUrl = settings.RepositoryUrl,
                InteractiveGdbHost = settings.InteractiveGdbHost,
                Similarities = (await relationshipRepo.GetRelationShips(new DumpIdentifier(bundleId, dumpId)))
                               .Select(x => new KeyValuePair <DumpMetainfo, double>(dumpRepo.Get(x.Key), x.Value)),
                IsDumpAvailable = dumpRepo.IsPrimaryDumpAvailable(bundleId, dumpId)
            }));
        }
Esempio n. 3
0
        public async Task <IActionResult> Report(string bundleId, string dumpId)
        {
            ViewData["Message"] = "Get Report";
            var id = DumpIdentifier.Create(bundleId, dumpId);

            var bundleInfo = superDumpRepo.GetBundle(bundleId);

            if (bundleInfo == null)
            {
                logger.LogNotFound("Report: Bundle not found", HttpContext, "BundleId", bundleId);
                return(View(null));
            }

            var dumpInfo = superDumpRepo.GetDump(id);

            if (dumpInfo == null)
            {
                logger.LogNotFound("Report: Dump not found", HttpContext, "Id", id.ToString());
                return(View(null));
            }

            logger.LogDumpAccess("Report", HttpContext, bundleInfo, dumpId);

            string   sdReadError = string.Empty;
            SDResult res         = null;

            try {
                res = await superDumpRepo.GetResultAndThrow(id);
            } catch (Exception e) {
                sdReadError = e.ToString();
            }

            // don't add relationships when the repo is not ready yet. it might take some time with large amounts.
            IEnumerable <KeyValuePair <DumpMetainfo, double> > similarDumps =
                !relationshipRepo.IsPopulated ? Enumerable.Empty <KeyValuePair <DumpMetainfo, double> >() :
                (await relationshipRepo.GetRelationShips(DumpIdentifier.Create(bundleId, dumpId)))
                .Select(x => new KeyValuePair <DumpMetainfo, double>(dumpRepo.Get(x.Key), x.Value)).Where(dump => dump.Key != null);

            return(base.View("Report", new ReportViewModel(id)
            {
                BundleFileName = bundleInfo.BundleFileName,
                DumpFileName = dumpInfo.DumpFileName,
                Result = res,
                CustomProperties = Utility.Sanitize(bundleInfo.CustomProperties),
                TimeStamp = dumpInfo.Created,
                Files = dumpRepo.GetFileNames(id),
                AnalysisError = dumpInfo.ErrorMessage,
                ThreadTags = res != null ? res.GetThreadTags() : new HashSet <SDTag>(),
                PointerSize = res == null ? 8 : (res.SystemContext?.ProcessArchitecture == "X86" ? 8 : 12),
                CustomTextResult = await ReadCustomTextResult(dumpInfo),
                SDResultReadError = sdReadError,
                DumpType = dumpInfo.DumpType,
                RepositoryUrl = settings.RepositoryUrl,
                InteractiveGdbHost = settings.InteractiveGdbHost,
                SimilarityDetectionEnabled = settings.SimilarityDetectionEnabled,
                Similarities = similarDumps,
                MainBundleJiraIssues = !settings.UseJiraIntegration || !jiraIssueRepository.IsPopulated ? Enumerable.Empty <JiraIssueModel>() : await jiraIssueRepository.GetAllIssuesByBundleIdWithoutWait(bundleId),
                SimilarDumpIssues = !settings.UseJiraIntegration || !jiraIssueRepository.IsPopulated ? new Dictionary <string, IEnumerable <JiraIssueModel> >() : await jiraIssueRepository.GetAllIssuesByBundleIdsWithoutWait(similarDumps.Select(dump => dump.Key.BundleId)),
                UseJiraIntegration = settings.UseJiraIntegration,
                DumpStatus = dumpInfo.Status,
                IsRelationshipsPopulated = relationshipRepo.IsPopulated || !settings.SimilarityDetectionEnabled,
                IsJiraIssuesPopulated = jiraIssueRepository.IsPopulated || !settings.UseJiraIntegration,
                UseAutomaticDumpDeletion = settings.IsDumpRetentionEnabled(),
                DumpRetentionExtensionDays = settings.DumpRetentionExtensionDays,
                RetentionViewModel = new RetentionViewModel(
                    dumpInfo,
                    dumpRepo.IsPrimaryDumpAvailable(id),
                    TimeSpan.FromDays(settings.WarnBeforeDeletionInDays),
                    settings.UseJiraIntegration && jiraIssueRepository.IsPopulated && jiraIssueRepository.HasBundleOpenIssues(bundleId))
            }));
        }