Exemple #1
0
        // called by WebSocketManager
        public void StartSession(string socketId, string bundleId, string dumpId, string initialCommand)
        {
            try {
                System.Console.WriteLine($"StartSession ({socketId}): {bundleId}, {dumpId}");
                if (string.IsNullOrEmpty(bundleId) || string.IsNullOrEmpty(dumpId))
                {
                    return;
                }
                var dumpInfo         = dumpRepo.Get(bundleId, dumpId);
                var dumpFilePath     = dumpRepo.GetDumpFilePath(bundleId, dumpId);
                var dumpFilePathInfo = dumpFilePath != null ? new FileInfo(dumpFilePath) : null;
                var workingDirectory = dumpFilePathInfo?.Directory;

                var  sdResult         = dumpRepo.GetResult(bundleId, dumpId).Result;
                bool is64bit          = sdResult?.SystemContext.ProcessArchitecture.Contains("64") ?? true;        // default to 64 bit in case it's not known
                ConsoleAppManager mgr = null;
                var initialCommands   = new List <string>();
                if (dumpInfo.DumpFileName.EndsWith(".dmp", StringComparison.OrdinalIgnoreCase))
                {
                    mgr = StartCdb(socketId, workingDirectory, dumpFilePathInfo, is64bit, bundleId, dumpId);
                    initialCommands.Add(".cordll -ve -u -l");                     // load DAC and SOS
                }
                else
                {
                    throw new NotSupportedException($"file extension of '{dumpInfo.DumpFileName}' not supported for interactive mode.");
                }
                if (mgr != null && !string.IsNullOrEmpty(initialCommand))
                {
                    initialCommands.Add(WebUtility.UrlDecode(initialCommand));
                }
                RunInitialCommandsAsync(socketId, mgr, initialCommands);
            } catch (Exception e) {
                Console.WriteLine($"Error in StartSession: {e}");
            }
        }
        public async Task <IActionResult> CompareDumps(string bundleId1, string dumpId1, string bundleId2, string dumpId2)
        {
            try {
                var res1 = await dumpRepository.GetResult(bundleId1, dumpId1);

                var res2 = await dumpRepository.GetResult(bundleId2, dumpId2);

                if (res1 == null || res2 == null)
                {
                    return(View(new SimilarityModel($"could not compare dumps.")));
                }
                var similarity = CrashSimilarity.Calculate(res1, res2);
                return(View(new SimilarityModel(new DumpIdentifier(bundleId1, dumpId2), new DumpIdentifier(bundleId2, dumpId2), similarity)));
            } catch (Exception e) {
                return(View(new SimilarityModel($"exception while comparing: {e.ToString()}")));
            }
        }