本文整理汇总了C#中UnhandledExceptionEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# UnhandledExceptionEventArgs类的具体用法?C# UnhandledExceptionEventArgs怎么用?C# UnhandledExceptionEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnhandledExceptionEventArgs类属于命名空间,在下文中一共展示了UnhandledExceptionEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnApplicationUnhandledException
static void OnApplicationUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
var exception = e.ExceptionObject as Exception;
Debug.Assert(exception != null, "exception != null");
// Write the exception's details to a log file
using (var stream = new StreamWriter(Path.Combine(Utilities.ApplicationBaseDirectory, "CrashLogs.txt"), true)) {
stream.WriteLine(
Utilities.NewLineString +
exception.Message + Utilities.NewLineString +
exception.StackTrace
);
}
// Make sure that Monero core applications get closed before exit
if (Utilities.MoneroRpcManager != null) {
Utilities.MoneroRpcManager.Dispose();
}
if (Utilities.MoneroProcessManager != null) {
Utilities.MoneroProcessManager.Dispose();
}
// Exit with an error code
Environment.Exit(1);
}
示例2: ExceptionHandler
private static void ExceptionHandler(object sender, UnhandledExceptionEventArgs args)
{
Exception e = (Exception) args.ExceptionObject;
Console.WriteLine("ExceptionHandler caught {0} with message {1}.\nExiting: ", e,
e.Message);
Environment.Exit(1);
}
示例3: SynchronizationContext_UnhandledException
private async void SynchronizationContext_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
e.Handled = true;
await new MessageDialog("Synchronization Context Unhandled Exception:\r\n" + e.Exception.Message)
.ShowAsync();
}
示例4: App_UnhandledException
private void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
var errorMessage = e.Exception.ToString();
Debug.WriteLine(errorMessage);
var message = new MessageDialog(errorMessage, "An error occurred").ShowAsync();
e.Handled = true;
}
示例5: unhandledException
// Invoked when unhandled event occurs
static void unhandledException(object sender, UnhandledExceptionEventArgs args)
{
//TODO create some sort of notification service for unhandled exceptions
Exception e = (Exception)args.Exception;
Debug.WriteLine("MyHandler caught : " + e.Message);
}
示例6: GetSongs
public Task<IEnumerable<Song>> GetSongs(string query, CancellationToken cancellationToken)
{
return Task.Factory.StartNew(() =>
{
var lockObject = new object();
var songs = new List<Song>(200);
Parallel.ForEach(Providers, p =>
{
try
{
var result = p.GetSongs(query, cancellationToken).Result;
lock (lockObject)
{
songs.AddRange(result);
}
}
catch(Exception e)
{
var args = new UnhandledExceptionEventArgs(e);
OnUnhandledException(args);
if (!args.Handled)
{
throw;
}
}
});
return (IEnumerable<Song>)songs.ToArray();
});
}
示例7: App_UnhandledException
private async void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
e.Handled = true;
var unhandledException = e.Exception;
var dialog = new MessageDialog([email protected]"Homebased crashed :(
{Environment.NewLine}Please close the application and try again.
{Environment.NewLine}But before you do, do you want to mail us the crash report, to see if there's anything we can do?", "Homebased crashed #!$*");
dialog.Commands.Add(new UICommand("Yes", new UICommandInvokedHandler(async cmd =>
{
var sendTo = new EmailRecipient()
{
Name = "Homebased",
Address = "[email protected]"
};
var mail = new EmailMessage();
mail.Subject = $"Homebased crashed :(";
mail.Body = unhandledException.ToString();
mail.To.Add(sendTo);
await EmailManager.ShowComposeNewEmailAsync(mail);
})));
dialog.Commands.Add(new UICommand("No", new UICommandInvokedHandler(cmd =>
{
})));
await dialog.ShowAsync();
}
示例8: OnUnhandledException
static void OnUnhandledException (object sender, UnhandledExceptionEventArgs e)
{
lock (monitor) {
Monitor.Pulse (monitor);
}
Environment.Exit (0);
}
示例9: AppUnhandledException
private async void AppUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
e.Handled = true;
await new MessageDialog("应用程序出错:\r\n" + e.Exception.Message)
.ShowAsync();
}
示例10: App_UnhandledException
private async void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
_telemetryClientProvider.Client.TrackException(e.Exception);
_telemetryClientProvider.Client.Flush();
await new MessageDialog(e.Exception.Message).ShowAsync();
}
示例11: MyHandler
public static void MyHandler(object
sender,
UnhandledExceptionEventArgs
args)
{
Console.WriteLine("UnhandledExceptionEventHandler called");
}
示例12: CurrentDomain_UnhandledException
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Exception theException = (Exception)e.ExceptionObject;
Console.WriteLine(theException.ToString());
// Exit to avoid unhandled exception dialog
Environment.Exit(-1);
}
示例13: App_UnhandledException
private void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
if (System.Diagnostics.Debugger.IsAttached)
{
// An unhandled exception has occurred; break into the debugger
System.Diagnostics.Debugger.Break();
}
}
示例14: App_UnhandledException
private void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
if (Debugger.IsAttached)
{
Debug.WriteLine(e.Message);
Debug.WriteLine(e.Exception.StackTrace);
}
}
示例15: App_UnhandledException
void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
LogHelper.Error(e.Exception);
//LOG Exception
e.Handled = true;
System.Diagnostics.Debug.WriteLine(string.Format("{1} @ {0} @ {2} ", e.Exception, e.Message,
e.Exception != null ? e.Exception.StackTrace : string.Empty));
//throw new NotImplementedException();
}