本文整理汇总了C#中Error.SendToServer方法的典型用法代码示例。如果您正苦于以下问题:C# Error.SendToServer方法的具体用法?C# Error.SendToServer怎么用?C# Error.SendToServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Error
的用法示例。
在下文中一共展示了Error.SendToServer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UnhandledExceptionLogger
private static ProcessFlow UnhandledExceptionLogger(Exception exp, StackFrame[] callStackFrames, String errorTitle)
{
//
// If number of errors exist in cache more than MaxQueuedError then skip new errors
if (CacheController.SdfManager.ErrorIds.Count > ErrorHandlingOption.MaxQueuedError)
{
if (!ErrorHandlingOption.AtSentState && ErrorHandlingOption.EnableNetworkSending)
Task.Run(async () => await CacheController.CheckStateAsync());
return ErrorHandlingOption.ExitApplicationImmediately;
}
bool snapshot;
//
// ---------------------------- Filter exception ---------------------------------------
if (Filter.IsFiltering(exp, callStackFrames, out snapshot))
return ErrorHandlingOption.ExitApplicationImmediately;
//
// initial the error object by additional data
var error = new Error(exp, callStackFrames, snapshot) { IsHandled = false };
//
// Store Error object
if (ErrorHandlingOption.LogOnTheFly)
{
Task.Run(async () => await error.SendToServer());
}
else
{
CacheController.CacheTheError(error);
}
//
// Handle 'OnShowUnhandledError' events
OnShowUnhandledError(exp, new UnhandledErrorEventArgs(error));
//
// Alert Unhandled Error
if (ErrorHandlingOption.DisplayUnhandledExceptions)
{
if (ErrorHandlingOption.DisplayDeveloperUI)
{
var msgResult = ProcessFlow.Continue;
var staThread = new Thread(() =>
{
var msg = new ExceptionViewer { Title = errorTitle };
msg.Dispatcher.Invoke(() => msgResult = msg.ShowDialog(exp));
});
staThread.SetApartmentState(ApartmentState.STA);
staThread.Start();
staThread.Join();
return msgResult;
}
//
// ELSE:
MessageBox.Show(error.Message,
errorTitle,
MessageBoxButtons.OK, MessageBoxIcon.Error,
MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
}
return ErrorHandlingOption.ExitApplicationImmediately;
}
示例2: HandledExceptionLogger
private static ProcessFlow HandledExceptionLogger(Exception exp, StackFrame[] callStackFrames)
{
//
// If number of errors exist in cache more than MaxQueuedError then skip new errors
if (CacheController.SdfManager.ErrorIds.Count > ErrorHandlingOption.MaxQueuedError)
{
if (!ErrorHandlingOption.AtSentState && ErrorHandlingOption.EnableNetworkSending)
Task.Run(async () => await CacheController.CheckStateAsync());
return ProcessFlow.Continue;
}
if (!ErrorHandlingOption.ReportHandledExceptions) // Do not store exception data
return ProcessFlow.Continue;
bool snapshot;
//
// ---------------------------- Filter exception ---------------------------------------
if (Filter.IsFiltering(exp, callStackFrames, out snapshot))
return ProcessFlow.Continue;
//
// initial the error object by additional data
var error = new Error(exp, callStackFrames, snapshot);
//
// Store Error object
if (ErrorHandlingOption.LogOnTheFly)
{
Task.Run(async () => await error.SendToServer());
}
else
{
CacheController.CacheTheError(error);
}
return ProcessFlow.Continue;
}