representing additional meta info to a crashlog
コード例 #1
0
        internal CrashData(HockeyClient hockeyClient, Exception ex, CrashLogInformation crashLogInfo)
        {
            if (hockeyClient == null)
            {
                throw new ArgumentNullException("hockeyClient");
            }

            this._hockeyClient = hockeyClient;

            StringBuilder builder = new StringBuilder();

            builder.Append(crashLogInfo.ToString());
            builder.AppendLine();
            builder.Append(ex.StackTraceToString());
            this.Log = builder.ToString();

            this.UserID     = this._hockeyClient.UserID;
            this.Contact    = this._hockeyClient.ContactInformation;
            this.SDKName    = this._hockeyClient.SdkName;
            this.SDKVersion = this._hockeyClient.SdkVersion;
            if (this._hockeyClient.DescriptionLoader != null)
            {
                try
                {
                    this.Description = this._hockeyClient.DescriptionLoader(ex);
                }
                catch (Exception e) {
                    hockeyClient.HandleInternalUnhandledException(e);
                }
            }
        }
コード例 #2
0
        internal CrashData(HockeyClient hockeyClient, Exception ex, CrashLogInformation crashLogInfo){
            if (hockeyClient == null) { throw new ArgumentNullException("hockeyClient"); }
            
            this._hockeyClient = hockeyClient;

            StringBuilder builder = new StringBuilder();
            builder.Append(crashLogInfo.ToString());
            builder.AppendLine();
            builder.Append(ex.StackTraceToString());
            this.Log = builder.ToString();

            this.UserID = this._hockeyClient.UserID;
            this.Contact = this._hockeyClient.ContactInformation;
            this.SDKName = this._hockeyClient.SdkName;
            this.SDKVersion = this._hockeyClient.SdkVersion;
            if (this._hockeyClient.DescriptionLoader != null)
            {
                try
                {
                    this.Description = this._hockeyClient.DescriptionLoader(ex);
                }
                catch (Exception e) {
                    hockeyClient.HandleInternalUnhandledException(e);
                }
            }
        }
コード例 #3
0
        private void HandleException(Exception e)
        {
            try
            {
                string crashID = Guid.NewGuid().ToString();
                String filename = String.Format(CultureInfo.InvariantCulture, "{0}{1}.log", HockeyConstants.CrashFilePrefix, crashID);

                CrashLogInformation logInfo = new CrashLogInformation()
                {
                    PackageName = Application.Current.GetType().Namespace,
                    Version = HockeyClient.Current.AsInternal().VersionInfo,
                    OperatingSystem = Environment.OSVersion.Platform.ToString(),
                    Windows = Environment.OSVersion.Version.ToString() + Environment.OSVersion.ServicePack,
                    Manufacturer = "",
                    Model = ""
                };

                ICrashData crash = HockeyClient.Current.AsInternal().CreateCrashData(e, logInfo);
                using (FileStream stream = File.Create(Path.Combine(HockeyConstants.GetPathToHockeyCrashes(), filename)))
                {
                    crash.Serialize(stream);
                    stream.Flush();
                }
            }
            catch (Exception ex)
            {
                HockeyClient.Current.AsInternal().HandleInternalUnhandledException(ex);
            }
        }
コード例 #4
0
        //needed for crashes from unity-log
        internal CrashData(HockeyClient hockeyClient, string logString, string stackTrace, CrashLogInformation crashLogInfo)
        {
            this._hockeyClient = hockeyClient;
            StringBuilder builder = new StringBuilder();
            builder.Append(crashLogInfo.ToString());
            builder.AppendLine();
            builder.Append(logString);
            builder.AppendLine();
            builder.AppendLine(string.IsNullOrEmpty(stackTrace) ? "  at unknown location" : stackTrace);
            this.Log = builder.ToString();

            this.UserID = this._hockeyClient.UserID;
            this.Contact = this._hockeyClient.ContactInformation;
            this.SDKName = this._hockeyClient.SdkName;
            this.SDKVersion = this._hockeyClient.SdkVersion;
            //we don't support DescriptionLoader from unity at the moment
        }
コード例 #5
0
        //needed for crashes from unity-log
        internal CrashData(HockeyClient hockeyClient, string logString, string stackTrace, CrashLogInformation crashLogInfo)
        {
            this._hockeyClient = hockeyClient;
            StringBuilder builder = new StringBuilder();

            builder.Append(crashLogInfo.ToString());
            builder.AppendLine();
            builder.Append(logString);
            builder.AppendLine();
            builder.AppendLine(string.IsNullOrEmpty(stackTrace) ? "  at unknown location" : stackTrace);
            this.Log = builder.ToString();

            this.UserID     = this._hockeyClient.UserID;
            this.Contact    = this._hockeyClient.ContactInformation;
            this.SDKName    = this._hockeyClient.SdkName;
            this.SDKVersion = this._hockeyClient.SdkVersion;
            //we don't support DescriptionLoader from unity at the moment
        }
コード例 #6
0
        internal void HandleException(Exception unhandledException)
        {
            CrashLogInformation crashInfo = this._crashLogInfo;
            //TODO refactor in next version
            if (this._crashLogInfo.PackageName == null) { this._crashLogInfo = HockeyClient.Current.AsInternal().PrefilledCrashLogInfo; }
            ICrashData cd = HockeyClient.Current.AsInternal().CreateCrashData(unhandledException, this._crashLogInfo);

            var crashId = Guid.NewGuid();
            try
            {
                IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication();
                if (!store.DirectoryExists(Constants.CrashDirectoryName))
                {
                    store.CreateDirectory(Constants.CrashDirectoryName);
                }

                String filename = string.Format(CultureInfo.InvariantCulture, "{0}{1}.log", Constants.CrashFilePrefix, crashId);
                using (FileStream stream = store.CreateFile(Path.Combine(Constants.CrashDirectoryName, filename)))
                {
                    cd.Serialize(stream);
                }
            }
            catch (Exception ex)
            {
                HockeyClient.Current.AsInternal().HandleInternalUnhandledException(ex);
            }
        }