Ejemplo n.º 1
0
        public IEnumerator SendUnhandledGameCrashesOnGameStartup()
        {
            if (string.IsNullOrEmpty(nativeCrashesDir) || !Directory.Exists(nativeCrashesDir))
            {
                yield break;
            }
            else
            {
                var crashDirs = Directory.GetDirectories(nativeCrashesDir);
                foreach (var crashDir in crashDirs)
                {
                    var crashDirFullPath = Path.Combine(nativeCrashesDir, crashDir);
                    var crashFiles       = Directory.GetFiles(crashDirFullPath);

                    var alreadyUploaded = crashFiles.Any(n => n.EndsWith("backtrace.json"));
                    if (alreadyUploaded)
                    {
                        continue;
                    }
                    var minidumpPath = crashFiles.FirstOrDefault(n => n.EndsWith("crash.dmp"));
                    if (string.IsNullOrEmpty(minidumpPath))
                    {
                        continue;
                    }
                    var attachments = crashFiles.Where(n => n != minidumpPath);
                    yield return(_backtraceApi.SendMinidump(minidumpPath, attachments, (BacktraceResult result) =>
                    {
                        if (result != null && result.Status == BacktraceResultStatus.Ok)
                        {
                            File.Create(Path.Combine(crashDirFullPath, "backtrace.json"));
                        }
                    }));
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Read directory structure in the native crash directory and send new crashes to Backtrace
        /// </summary>
        public IEnumerator SendUnhandledGameCrashesOnGameStartup()
        {
            if (string.IsNullOrEmpty(NativeCrashesDir) || !Directory.Exists(NativeCrashesDir))
            {
                yield break;
            }
            else
            {
                var crashDirs = Directory.GetDirectories(NativeCrashesDir);
                foreach (var crashDir in crashDirs)
                {
                    var crashDirFullPath = Path.Combine(NativeCrashesDir, crashDir);
                    var crashFiles       = Directory.GetFiles(crashDirFullPath);

                    var alreadyUploaded = crashFiles.Any(n => n.EndsWith("backtrace.json"));
                    if (alreadyUploaded)
                    {
                        continue;
                    }
                    var minidumpPath = crashFiles.FirstOrDefault(n => n.EndsWith("crash.dmp"));
                    if (string.IsNullOrEmpty(minidumpPath))
                    {
                        continue;
                    }
                    var attachments = crashFiles.Where(n => n != minidumpPath);
                    var attributes  = new Dictionary <string, string>()
                    {
                        { "guid", MachineUuid },
                        { "application.version", ApplicationVersion },
                        { "error.type", "Crash" },
                        { BacktraceMetrics.ApplicationSessionKey, string.IsNullOrEmpty(SessionId) ? "null" : SessionId }
                    };
                    yield return(_backtraceApi.SendMinidump(minidumpPath, attachments, attributes, (BacktraceResult result) =>
                    {
                        if (result != null && result.Status == BacktraceResultStatus.Ok)
                        {
                            File.Create(Path.Combine(crashDirFullPath, "backtrace.json"));
                        }
                    }));
                }
            }
        }