private string errorData2jsonstr(ErrorInfo obj) { string ret = ""; ret = UmsJson.Serialize(obj); return ret; }
//save crash info when app crash public void crashDataProceed(ApplicationUnhandledExceptionEventArgs ex,string flag="ums crash") { Exception e = ex.ExceptionObject; string err_title = e.Message == null ? "" : e.Message; string err_stack_trace = e.StackTrace == null ? "" : e.StackTrace; string error_title_statcktrace = err_title + "\r\n" + err_stack_trace; ErrorInfo error = new ErrorInfo(); error.appkey = appkey; //error.stacktrace = ex.Message+"\r\n"+ex.StackTrace; error.stacktrace = error_title_statcktrace; error.time = Utility.getTime(); error.version = Utility.getApplicationVersion() == null ? "" : Utility.getApplicationVersion(); error.activity = Utility.getCurrentPageName(); error.deviceid = Utility.getDeviceName(); error.os_version = Utility.getOsVersion(); string error_info = UmsJson.Serialize(error); CrashListener.ReportException(error_info, flag); }
internal static void ReportException(Exception ex, string extra) { try { using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { SafeDeleteFile(store); using (TextWriter output = new StreamWriter(store.CreateFile(filename))) { ErrorInfo error = new ErrorInfo(); error.appkey = UmsManager.appkey; error.stacktrace = ex.Message+"\r\n"+ex.StackTrace; error.time = Utility.getTime(); error.version = Utility.getApplicationVersion(); error.activity = Utility.getCurrentPageName(); error.deviceid = Utility.getDeviceName(); error.os_version = Utility.getOsVersion(); string str =UmsJson.Serialize(error); output.WriteLine(str); } } } catch (Exception) { } }